User Tools

Site Tools


development:csdk:2.0:headers:sprites

sprites.h

Functions

allocate_sprite

SpriteSlot allocate_sprite(SpritePage* sprite);

Allocate space for an image in Sprite RAM and return a single-byte handle for that image.

Every BMP asset gets a _load_list struct generated. Images greater than 128 pixels in length or width will be broken into multiple parts, as each 256×256 Sprite RAM page is accessed in four quadrants requiring separate load operations for each.

set_sprite_frametable

void set_sprite_frametable(SpriteSlot sprite, const Frame *frametable, char frametable_bank);

Associate an Aseprite-generated sprite packing table with a SpriteSlot handle, required for using queue_draw_sprite_frame ordirect_draw_sprite_frame

free_sprite

void free_sprite(SpriteSlot slot);

Free a SpriteSlot handle and the occupied Sprite RAM space so that it can be given out by allocate_sprite again.

clear_spritebank

void clear_spritebank(char bank);

Sets all pixels in a given sprite bank to 0. Not required after freeing the sprite, just used for weird advanced procedural drawing stuff.

sprite_fetch_frame

void sprite_fetch_frame(SpriteSlot sprite, char frame);

Used internally by queue_draw_sprite_frame and direct_draw_sprite_frame. Grabs the Aseprite-generated sprite packing data (X, Y, width, height) from a sprite pack table and sets the values in the global struct sprite_temp_frame.

load_spritesheet

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

Used internally by allocate_sprite.

Decompress image data into a specific Sprite RAM area. Used by itself it won't affect the sprite allocation table. You can generally use the same value passed to ramBank as the SpriteSlot parameter on draw calls.

development/csdk/2.0/headers/sprites.txt · Last modified: 2024/11/20 21:37 by clyde