Functions taking SDL_Color or 4 Uint8?


After a few monthes using SDL2, I still wonder why some functions takes 4 distincts Uint8 parameters (r,g,b,a) to describe a color. Why do not they take a SDL_Color struct that can express the same four bytes ?

int SDL_SetRenderDrawColor(SDL_Renderer* renderer,
Uint8 r,
Uint8 g,
Uint8 b,
Uint8 a)

I don’t know, but SDL_Color appears only to be used as an element of an array, i.e. in a palette, so that is at least consistent. Be grateful that core SDL2 doesn’t do what SDL2_gfx does, which is to pass a color as an int and then convert it to RGBA differently according to the endian-ness of the CPU! :roll_eyes: