Sprite Functions
init_satb( void );
Initialize the internal Sprite Attribute Table (SATB) used by the library to handle sprites.
This function must be called before any other sprite function is called.
reset_satb( void );
Reset the internal SATB, this has the effect to disable and reset all the sprites.
satb_update( void );
Copy the internal sprite attribute table to the video ram.
This will refresh sprites on the screen. Use this function regularly to update the sprite display.
The best place to call satb_update()
is after every vsync()
call, but no need to call satb_update()
if you didn't change any sprite attribute. 'nb' specifys the number of sprite to refresh; starting from sprite 0. By default the library refreshes only the sprites you use, but if you need to implicitely refresh a certain number of sprites then you can use 'nb'.
spr_set( unsigned char num );
Select sprite 'num' (0-63) as the current sprite.
spr_hide( void );
Without parameters this function will hide the current sprite. Use 'num' to hide a different sprite than the current one.
spr_show( void );
Show a sprite that has been hidden using the spr_hide()
function.
spr_x( unsigned int value );
Set the x coordinate of the current sprite.
Negative values will make the sprite disappear under the left border, while values higher than the screen width will make it disappear under the right border.
spr_y( unsigned int value );
Set the y coordinate of the current sprite.
spr_pattern( unsigned int vaddr );
Set the pattern address in video memory of the current sprite.
spr_ctrl( unsigned char mask, unsigned char value );
Set different attributes of the current sprite.
With this function you can change the sprite size (16x16, 32x32, ...) and the sprite orientation (horizontal/vertical flipping).
spr_pal( unsigned char palette );
Set the palette-block index (0-15) of the current sprite.
spr_pri( unsigned char priority );
Set the priority of the current sprite. '0' will make it appear behind the background (through color 0), '1' will make it appear in front of the background.
spr_get_x( void );
Return the x coordinate of the current sprite.
spr_get_y( void );
Return the y coordinate of the current sprite.
Last updated