Sprite Functions

From Archaic Pixels
Revision as of 12:42, 13 September 2010 by Gravis (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sprite Functions


void load_sprites(int vaddr, int *spr_data, int nb_spr);
     Load sprite graphics data in video memory, at address
     'vaddr'. This function load sprites by chunk of 8 sprites
     of 16x16 pixels. 'nb_spr' is the number of chunk to load.
     If you need to load less 16x16 sprites than the eight
     contained in a chunk, use load_vram() function instead.


void 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.


void reset_satb(void);
     Reset the internal SATB, this has the effect
     to disable and reset all the sprites.


void satb_update(void);
void satb_update(char nb);
     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'.


void spr_set(char num);
     Select sprite 'num' (0-63) as the current sprite.


void spr_x(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.


void spr_y(int value);
     Set the y coordinate of the current sprite.


void spr_pattern(int vaddr);
     Set the pattern address in video memory of
     the current sprite.


void spr_ctrl(char mask, 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).


void spr_pal(char pal);
     Set the palette-block index (0-15) of the current sprite.


void spr_pri(char pri);
     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.


char spr_get_pal(void);
     Return the palette-block index (0-15) of the current


 ??? spr_get_pattern(void);
     Return the pattern address in video memory of
     the current sprite.


void spr_hide(void);
void spr_hide(char num);
     Without parameters this function will hide the current
     sprite. Use 'num' to hide a different sprite than
     the current one.


void spr_show(void);
void spr_show(char num);
     Show a sprite that has been hidden using the spr_hide()