This is an old revision of the document!
draw_queued.h
draw_queued.h provides a queued drawing API, so that draw operations can be set even while a previous draw is still running. The queue is interrupt-driven, meaning that the interrupt handler will check the queue and start the next draw operation if there is one in the list.
The programmer may switch between using Queued and Direct drawing methods at runtime, but care must be taken to transition between the modes so they don't interfere with each other in unpredictable ways.
Namely, await_drawing() should be used when changing from Direct to Queued drawing; and await_draw_queue() should be used before switching back to Direct drawing.
Drawing Example
//Draw a red box next to a green box queue_draw_box(23, 32, 16, 16, 29); queue_draw_box(39, 32, 16, 16, 124); //do other stuff while drawing is happening //wait for it to finish before flipping the frame await_draw_queue(); await_vsync(); flip_pages();
Functions
name
void queue_draw_box(unsigned char x, unsigned char y, unsigned char w, unsigned char h, unsigned char c);
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
name
void queue_draw_sprite_rect();
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
name
void queue_draw_sprite_frame(SpriteSlot sprite, char x, char y, char frame, char flip);
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
name
void queue_clear_border(char c);
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
name
void queue_clear_screen(char c);
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
name
void await_draw_queue();
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
Macros
name
DIRECT_DRAW_START()
Use DIRECT_DRAW_START() to start a draw operation after setting the blit registers. This macro includes setting the draw_busy flag so that await_drawing() from gfx_sys.h works properly.