Table of Contents
gfx_sys.h
gfx_sys.h provides functions and macros related to low level graphics system functions
Defines
Sprite flips
- SPRITE_FLIP_NONE - Apply no sprite flip
- SPRITE_FLIP_X - Apply horizontal sprite flipping
- SPRITE_FLIP_Y - Apply vertical sprite flipping
- SPRITE_FLIP_BOTH - Apply sprite flipping on both axes
Sprite RAM Sections
- QUADRANT_0 - Upper left quadrant of Sprite RAM page
- QUADRANT_1 - Upper right quadrant of Sprite RAM page
- QUADRANT_2 - Bottom left quadrant of Sprite RAM page
- QUADRANT_3 - Bottom right quadrant of Sprite RAM page
Functions
init_graphics
void init_graphics();
Call this to initialize the graphics system and prepare it for sequential drawing. Should only need to be called once at the beginning of the program.
await_vsync
void await_vsync(int frames);
Call this to block execution until the next vsync (frames=1) or wait for a number of vsyncs to pass (frames>1). Best used at the end of drawing and updating the game state.
flip_pages
void flip_pages();
Switch which framebuffer is being drawn on and which framebuffer is being sent to the TV. Call this right after await_vsync for consistent timing.
await_drawing
void await_drawing();
Waits for the current draw operation to complete.
Graphics API calls that use the blitter will set the global `draw_busy` variable to 1, and this function waits for the interrupt to set it to zero.