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??

Recommended Answers

All 2 Replies

http://www.cplusplus.com/doc/tutorial/classes.html
Very bottom of page, second to last section. Basically screen is a pointer that points to a class and you directly access it through ->. Could be a struct instead of a class but you get the point.

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.
Thanks

If you can help me out with this:

bufp = (Uint32 *)screen->pixels + y*screen->pitch/4 + x;
Huuh.
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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.