GBDK 2020 Docs  4.3.0
API Documentation for GBDK 2020
cgb.h
Go to the documentation of this file.
1 
17 #ifndef _CGB_H
18 #define _CGB_H
19 
20 #include <types.h>
21 #include <stdint.h>
22 
33 #define RGB(r, g, b) ((uint16_t)((((b) & 0x1f) << 10) | ((uint16_t)(((g) & 0x1f) << 5)) | ((r) & 0x1f)))
34 
47 #define RGB8(r, g, b) (((uint16_t)((((b) >> 3) & 0x1f) << 10)) | ((uint16_t)((((g) >> 3) & 0x1f) << 5)) | (((r) >> 3) & 0x1f))
48 
59 #define RGBHTML(RGB24bit) (RGB8((((RGB24bit) >> 16) & 0xff), (((RGB24bit) >> 8) & 0xff), ((RGB24bit) & 0xff)))
60 
63 #define RGB_RED RGB(31, 0, 0)
64 #define RGB_DARKRED RGB(15, 0, 0)
65 #define RGB_GREEN RGB( 0, 31, 0)
66 #define RGB_DARKGREEN RGB( 0, 15, 0)
67 #define RGB_BLUE RGB( 0, 0, 31)
68 #define RGB_DARKBLUE RGB( 0, 0, 15)
69 #define RGB_YELLOW RGB(31, 31, 0)
70 #define RGB_DARKYELLOW RGB(21, 21, 0)
71 #define RGB_CYAN RGB( 0, 31, 31)
72 #define RGB_AQUA RGB(28, 5, 22)
73 #define RGB_PINK RGB(31, 0, 31)
74 #define RGB_PURPLE RGB(21, 0, 21)
75 #define RGB_BLACK RGB( 0, 0, 0)
76 #define RGB_DARKGRAY RGB(10, 10, 10)
77 #define RGB_LIGHTGRAY RGB(21, 21, 21)
78 #define RGB_WHITE RGB(31, 31, 31)
79 
80 #define RGB_LIGHTFLESH RGB(30, 20, 15)
81 #define RGB_BROWN RGB(10, 10, 0)
82 #define RGB_ORANGE RGB(30, 20, 0)
83 #define RGB_TEAL RGB(15, 15, 0)
84 
104 void set_bkg_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) OLDCALL;
105 
123 void set_sprite_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) OLDCALL;
124 
136 void set_bkg_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL;
137 
148 void set_sprite_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL;
149 
160 void cpu_slow(void);
161 
174 void cpu_fast(void);
175 
185 
188 void cgb_compatibility(void);
189 
190 #endif /* _CGB_H */
#define OLDCALL
Definition: types.h:21
void set_bkg_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) OLDCALL
void set_default_palette(void)
void cpu_slow(void)
void cgb_compatibility(void)
Definition: sms.h:580
void set_sprite_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) OLDCALL
void cpu_fast(void)
Definition: msx.h:543
void set_bkg_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL
void set_sprite_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL
uint16_t palette_color_t
Definition: cgb.h:85
unsigned char uint8_t
Definition: stdint.h:51
unsigned short int uint16_t
Definition: stdint.h:52