forked from hkc/cc-stuff
1
0
Fork 0
cc-stuff/cc-common.h

26 lines
586 B
C
Raw Permalink Normal View History

#ifndef _CC_COMMON_H_
#define _CC_COMMON_H_
#include <stdint.h>
typedef uint8_t GlyphBitmap[11];
struct rgba { uint8_t r, g, b, a; };
union color {
struct rgba rgba;
uint32_t v;
};
struct palette {
const uint8_t count;
union color colors[] __attribute__((counted_by(count)));
};
#define LENGTHOF(...) (sizeof(__VA_ARGS__) / sizeof(*(__VA_ARGS__)))
#define PALETTE(...) { .count = LENGTHOF((union color[]){__VA_ARGS__}), .colors = {__VA_ARGS__} }
const extern GlyphBitmap cc_font_atlas[256];
const extern struct palette cc_default_palette, cc_default_gray_palette;
#endif