Table of Contents

drawing_funcs.h

drawing_funcs.h provides functions and macros related to putting stuff on the screen!

Defines

Sprite flips

Sprite RAM Sections

Functions

load_spritesheet

void load_spritesheet(char* spriteData, char srcBank, char ramBank);

Decompresses sprite data and places it into Sprite RAM.

Can also be use with only two apparent arguments, using the asset macros generated by “make import”.

load_spritesheet(&ASSET__gfx__mysprite_bmp, 0);

load_big_spritesheet

#define load_big_spritesheet(NAME,BANK)

Macro that calls load_spritesheet four times to load an images that spans a full Sprite RAM page.

clear_spritebank

void clear_spritebank(char bank);

* bank - section number of Sprite RAM to zero out

Fill a 128×128 Sprite RAM bank with zero-value pixels.

draw_sprite_frame

void draw_sprite_frame(const Frame *sprite_table, char sprite_table_bank, char x, char y, char frame, char flip, char bank);

Draws a packed sprite as exported from Aseprite with a given X,Y position and frame number. Drawing operation is added to the drawing queue if a drawing is already in progress.

draw_sprite

#define draw_sprite(X,Y,W,H,GX,GY,RAMBANK)

Macro that sets a temporary rect variable and then calls draw_sprite_rect();

draw_tile

#define draw_tile(X,Y,W,H,GX,GY,RAMBANK)

Macro that sets a temporary rect variable and then calls draw_sprite_rect(), with tiling mode enabled. Source data will repeat over a 16×16 square.

draw_box

void draw_box(unsigned char x, unsigned char y, unsigned char w, unsigned char h, unsigned char c);

Draws a solid color box, submitting the operation to the drawing queue and starting it if the queue isn't already processing.

next_draw_queue

void next_draw_queue();

If there are draw operations in the queue but the queue is not running, this function starts the queue processing.

await_draw_queue

void await_draw_queue();

If the drawing queue is running then this function loops and returns when the drawing queue finishes.

clear_border

void clear_border(char c);

Draws a border color around the screen. Uses the draw queue.

clear_screen

void clear_screen(char c);

Clear the screen to a background color. Uses the draw queue.

draw_box_now

void draw_box_now(char x, char y, char w, char h, char c);

Draws a colored box the same way as draw_box but skips/ignores/interrupts the draw queue.

draw_sprite_now

void draw_sprite_now(char x, char y, char w, char h, char gx, char gy, char ramBank);

Draw a sprite immediately, skipping/ignoring/interrupting the draw queue.

draw_tiles_now

void draw_tiles_now(char x, char y, char w, char h, char gx, char gy, char ramBank);

draw_fade

void draw_fade(unsigned char opacity);

Draws a repeated dither fade pattern across the whole screen. (Makes some very particular assumptions about what sprite data you've loaded and where? Need to check this)

printnum

void printnum(int num);
void print_hex_num(char num);

print

void print(char* str);