Jump to content
  • Advertisement
Sign in to follow this  
SKATIN_HARD

sdl color question

This topic is 4662 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
Advertisement
The possible colors that exist extend 0x00 to 0xFF, where 0xFF, 0xFF, 0xFF is white (opposite end of the spectrum) If you wanted to browse though colors, you could use an HTML Color Char, or a graphics program to see what the specific values are for any color.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!