jack moore
jack moore

Reputation: 2059

How to store SDL_Color in C++ array?

SDL_Color normColor = {255,255,255};
SDL_Color redColor = {255,0,0};
SDL_Color blackColor = { 0,0,0 };

etc.

What kind of array do I need to do something like:

typeofarray mycolorArray[95] = {normColor, redColor, blackColor..............};
....
mycolorArray[65] = redColor // to change the color

Upvotes: 0

Views: 1841

Answers (2)

user195488
user195488

Reputation:

How about instead of arrays, you use enum instead?

Color enum

or Class based example with enum.

Upvotes: 0

Steven
Steven

Reputation: 2558

SDL_Color sdlColors[] = {normColor, redColor, blackColor..............};

Upvotes: 2

Related Questions