Sign in to follow this  

sdl color question

This topic is 4360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For my pong game I used this piece of code: game.black = SDL_MapRGB(game.screen->format, 0x00, 0x00, 0x00); That basically makes the color equal black using the code 0x00. Now does anybody happen to know where I could find a list for other possible colors if it even exists?

Share this post


Link to post
Share on other sites
Well the data type is a Uint8, so it is 0 - 255 (Decimal) as Endar pointed out, but it can also be 0x00 - 0xFF (hex) Since HTML follows a 0xRRGGBB format, those numbers will also correlate with SDL's colors. Just keep in mind though, that you can specify any color you want, but that 'exact' color might not be used, but rather the closest color possible due to the image's format. If you use 24/32bpp surfaces, you have nothing to worry about, but if you use any less, then you might want to verify that the color you want to use is part of the pallet first.

Share this post


Link to post
Share on other sites

This topic is 4360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this