Krystian
10/01/2022, 6:00 PMKrystian
10/01/2022, 6:01 PM// Color, 4 components, R8G8B8A8 (32bit)
typedef struct Color {
unsigned char r; // Color red value
unsigned char g; // Color green value
unsigned char b; // Color blue value
unsigned char a; // Color alpha value
} Color;
And a macro is created as:
#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray
CLITERAL is yet another macro:
// NOTE: MSVC C++ compiler does not support compound literals (C99 feature)
// Plain structures in C++ (without constructors) can be initialized with { }
#if defined(__cplusplus)
#define CLITERAL(type) type
#else
#define CLITERAL(type) (type)
#endif
Adam Cooper
10/02/2022, 2:32 AMKrystian
10/02/2022, 5:38 AMnapperley
10/02/2022, 11:56 PMnapperley
10/02/2022, 11:59 PM