This is an old revision of the document!
Table of Contents
draw_direct.h
draw_direct.h provides macros and functions to support setting up draw operations by direct manipulation of blitter registers. The functions and macros are largely convenience functions for setting up the control registers for common operations, like drawing sprites or colored boxes.
Functions
name
void direct_prepare_sprite_mode(SpriteSlot sprite);
Setup registers to draw sprites in direct mode Also checks for and awaits queued drawing operations
name
void direct_quick_select_sprite(SpriteSlot sprite);
Both this and direct_prepare_sprite_mode select the sprite slot to use but this skips other register settings and ONLY selects the sprite slot
name
void direct_prepare_box_mode();
Setup registers to draw colored boxes in direct mode Also checks for and awaits queued drawing operations
name
void direct_tiled_mode(bool enabled);
If enabled, sprite draws will repeat the same 16×16 grid from the source data
name
void direct_transparent_mode(bool enabled);
If enabled, sprite draws will treat color 0 as transparent instead of black
name
void direct_clip_mode(clip_mode_t mode);
Set whether drawings will be clipped at screen edges or wrap around
name
void direct_draw_sprite_frame(SpriteSlot sprite, char x, char y, char frame, char flip);
Draws a packed sprite as exported from Aseprite with a given X,Y position and frame number. A SpriteSlot is a handle given by allocate_sprite in sprites.h
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.
name
DIRECT_DRAW_CLEAR_IRQ()
Clears the IRQ flag that is set by the blitter when it completes a draw operation.
name
DIRECT_DRAW_SPRITE(dst_x, dst_y, w, h, src_gx, src_gy)
Convenience macro for drawing a sprite, assuming that the sprite mode has already been set with direct_prepare_sprite_mode
name
DIRECT_DRAW_SPRITE(dst_x, dst_y, w, h, c)
Convenience macro for drawing a colored box, assuming that the box mode has already been set with direct_prepare_box_mode