foo
[gbajam21] / src / util.h
1 #ifndef UTIL_H_
2 #define UTIL_H_
3
4 #define wait_vblank() \
5         do { \
6                 while(REG_DISPSTAT & DISPSTAT_VBLANK); \
7                 while(!(REG_DISPSTAT & DISPSTAT_VBLANK)); \
8         } while(0)
9
10 #define present(x) \
11         do { \
12                 REG_DISPCNT = DISPCNT_BG2 | DISPCNT_OBJ | 4 | ((x) << 4); \
13         } while(0)
14
15
16 #define set_bg_color(idx, r, g, b) \
17         do { \
18                 ((uint16_t*)CRAM_BG_ADDR)[idx] = (uint16_t)(r) | ((uint16_t)(g) << 5) | ((uint16_t)(b) << 10); \
19         } while(0)
20
21
22 #endif  /* UTIL_H_ */