summaryrefslogtreecommitdiff
path: root/arm9/source/devices/screen.h
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2024-11-22 16:04:02 +1300
committerBen Bridle <ben@derelict.engineering>2024-11-22 16:15:11 +1300
commita05dc964313a3f1431b9d08d33afb4daf45c0819 (patch)
tree394074f98f30d7851a82038b1091456446df23c4 /arm9/source/devices/screen.h
parent4f8805869c469cb1b3685e03c3ea34d7654b5cb7 (diff)
downloadbedrock-nds-a05dc964313a3f1431b9d08d33afb4daf45c0819.zip
Update palette only when screen buffers flip
Previously, any palette updates would be immediately visible, but any screen updates would draw to the back buffer and would only become visible when the back buffer was copied to the front buffer. This could result in a flash of a new palette before the new screen had a chance to draw and become visible. To prevent this, a second palette was created to receive palette updates, with the updates only being copied to the visible palette when the screen buffers flip.
Diffstat (limited to 'arm9/source/devices/screen.h')
-rw-r--r--arm9/source/devices/screen.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/arm9/source/devices/screen.h b/arm9/source/devices/screen.h
index a406051..3e75334 100644
--- a/arm9/source/devices/screen.h
+++ b/arm9/source/devices/screen.h
@@ -25,9 +25,10 @@
typedef struct {
u16 *bgv, *fgv; // visible tile memory
- u16 *bg, *fg; // tile memory
- u16 *map; // tile map
- u16 *pal; // colour palette
+ u16 *bg, *fg; // buffered tile memory
+ u16 *map; // tile map (never changes)
+ u16 *palv; // visible colour palette
+ u16 pal[16]; // buffered colour palette
} Screen;
typedef struct {
@@ -43,6 +44,8 @@
} ScreenDevice;
void init_screens(void);
+ void scr_make_main(ScreenDevice *scr);
+ void scr_make_sub(ScreenDevice *scr);
void set_palette_high(ScreenDevice *scr, u8 high);
void set_palette_low(ScreenDevice *scr, u8 low);