Hi, I’ve been searching google for a way to assign an SDL_Color struct
from a single numeric value. I might be misremembering, but I thought
there was a way to do this. I thought I remembered seeing somewhere an
example using preprocessor defines to store colors (probably as hex
values) and then using those values to asign to an SDL_Color.
Obviously, when I try it like this, I get a compile error:
#define WHITE {255,255,255}
#define BLUE {0,0,255}
SDL_Color c = WHITE;//OK
c = BLUE;//Compile error
The only other way I can think of is to store SDL_Color objects for each
color I want to use.
static const SDL_Color WHITE = {255,255,255};
static const SDL_Color BLUE = {0,0,255};
SDL_Color c = WHITE;//OK
c = BLUE;//Now this is OK
jim