Do anybody know about this mapping in the SDL_MapRGB

SDL_MapRGB(screen->format, R, G, B)

The screen is my SDL_Surface.

Does this define only a single color. The RGB are Uint8 type and I set them As I wish from 0-256.

Uint32 color = SDL_MapRGB(screen->format, R, G, B);

i don't understand the -> operator exactly in this line??

9 Years
Discussion Span
Last Post by slacke

Yes thats exactly what I was looking for, how did you know that?? :)
"in order to refer directly to a member of an object pointed by a pointer we can use the arrow operator (->) of indirection"
But I read the whole site again. I like this tutorial very much.

If you can help me out with this:

bufp = (Uint32 *)screen->pixels + y*screen->pitch/4 + x;
I access a member in my screen object of SDL_Surface class called pixels. Add to it (y*pitch/4+x)?? And What is the (Uint32 *)
I know, maybe I am asking the irrelevant questions but I can't get no sleep until I find that out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.