[SDL] converting a UINT32 to SDL_Color and viceversa

David Olofson david at olofson.net
Thu Jan 27 12:33:09 PST 2005


On Thursday 27 January 2005 17.21, Roger D. Vargas wrote:
> How can i do this?

Depends on the format of that UINT32... Something like:

        SDL_Color c;
        c.r = i >> 16;
        c.g = i >> 8;
        c.b = i;
and
 i = (c.r << 16) | (c.g << 8) | c.b;


//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---




More information about the SDL mailing list