sp, spIntro
Introduces the sprite manipulation functions.
#include <sp.h> #include <sp.h> /* sp.h */
void spInit( Gfx *glistp );
void spFinish( Gfx *glistp );
void spMove( Sprite *sp, s32 xpos, s32 ypos );
void spScale( Sprite *sp, f32 xscale, f32 yscale );
void spFlip( Sprite *sp, u32 fliph, u32 flipv );
void spSetZ( Sprite *sp, s32 z );
void spColor( Sprite *sp, u8 red, u8 green, u8 blue, u8 alpha );
void spSetAttribute( Sprite *sp, u32 attributes );
void spClearAttribute( Sprite *sp, u32 attributes );
void spScissor( u32 xmin, u32 xmax, u32 ymin, u32 ymax );
Gfx *spDraw( Sprite *sp );
sp.h file holds the data structure type definitions, symbolic attribute names, and function prototypes. The data structures used by the sprite library are described in detail in the Sprites chapter of the N64 Programming Manual. Attributes are listed and described in the spSetAttribute and spClearAttribute function pages.
spInit is called at the beginning of sprite drawing. Some GBI display list commands need to be executed to get the RCP into the correct mode for sprite rendering.This function adds commands necessary for RCP's default texture mode components to the user-specified glistp.
spFinish is called at the end of sprite drawing. Some GBI display list commands need to be executed to have RCP complete all pending drawing operations and reset the RCP to its default state. This function adds necessary commands to the glistp that user has specified to reset the RCP's sate. This function also automatcally tacks on gSPEndDisplayList at the end of the list.
spMove sets the position of a sprite in the upper left corner on the screen.
spScale sets the size of a sprite. Set a value less than 1.0 for a smaller image. Set a value greater than or equal to 1.0 for a lager image.
spFlip controls the direction by which the sprite is drawn. (Currently not supported.)
spSetZ sets the depth of Z buffer for a sprite
Newly drawn sprite might be covered by the older sprite with the shallow Z value when this function is called. (Currently not supported.)
spColor sets the color of a sprite
Either PRIMITIVE_COLOR or FILL_COLOR can be set for the color of a sprite, depending on how the sprite is to be rendered.
spSetAttribute sets the user-specified attributes to a sprite
Multiple attributes bit-ORed (logical addition) can be specified.
spClearAttribute clears the use-specified attributes of a sprite. Multiple attributes bit-ORed (logical addition) can be specified in attr field.
spScissor sets the bounding region in which sprites will be drawn. By default, the region starts out with xmin=0, xmax=319, ymin=0, ymax=239.
Tiles of a sprite entirely outside of this region are not added to the display list to be output. Tiles partially outside the boundary are properly clipped
spDraw function constructs a display list starting at sp->next_dl that draws the sprite upon call into the frame buffer in the indicated way. This display list is always terminated with a gSPEndDispalyList entry. If it reaches the end of the list, the sp->next_dl entry will be updated to point to the next entry.
It returns a pointer to the starting point of the display list that was created.
1999/04/30 Changed Format