PAlib
Functions
3D Sprite System

Functions

void PA_Init3D ()
 Initializes 3D.
 
void PA_Init3D2Banks ()
 Initializes 3D taking two banks of VRAM.
 
void PA_3DProcess ()
 Renders the 3D sprites.
 
s16 PA_3DCreateTex (void *obj_data, u16 width, u16 height, u8 type)
 Creates a 3D texture.
 
void PA_3DCreateSpriteFromTex (u16 sprite, u16 texture, u16 width, u16 height, u8 palette, s16 x, s16 y)
 Creates a 3D sprite from a texture.
 
void PA_Reset3DSprites ()
 Resets the 3D system.
 
void PA_Reset3DSprites2Banks ()
 Resets the dual bank 3D system.
 
static u16 PA_3DCreateSprite (u16 sprite, void *image, u16 width, u16 height, u8 type, u8 palette, s16 x, s16 y)
 Creates a 3D sprite.
 
void PA_3DDeleteTex (u32 tex_gfx)
 Deletes a 3D texture.
 
static void PA_3DDeleteSprite (u16 sprite)
 Deletes a 3D sprite.
 
static void PA_3DSetSpriteX (u16 sprite, s16 x)
 Moves a 3D sprite in the X axis.
 
static void PA_3DSetSpriteY (u16 sprite, s16 y)
 Moves a 3D sprite in the Y axis.
 
static void PA_3DSetSpriteXY (u16 sprite, s16 x, s16 y)
 Moves a 3D sprite.
 
static void PA_3DSetSpriteRotateX (u16 sprite, s16 rotateX)
 Rotates a 3D sprite in the X axis.
 
static void PA_3DSetSpriteRotateY (u16 sprite, s16 rotateY)
 Rotates a 3D sprite in the Y axis.
 
static void PA_3DSetSpriteRotateZ (u16 sprite, s16 rotate)
 Rotates a 3D sprite in the Z axis.
 
static void PA_3DSetSpriteRotateXYZ (u16 sprite, s16 rotateX, s16 rotateY, s16 rotateZ)
 Rotates a 3D sprite.
 
static void PA_3DSetSpriteZoomX (u16 sprite, float zoomx)
 Zooms a 3D sprite horizontally.
 
static void PA_3DSetSpriteZoomY (u16 sprite, float zoomy)
 Zooms a 3D sprite vertically.
 
static void PA_3DSetSpriteZoomXY (u16 sprite, float zoomx, float zoomy)
 Zooms a 3D sprite.
 
static void PA_3DSetSpriteWidth (u16 sprite, u16 width)
 Changes the width of a 3D sprite.
 
static void PA_3DSetSpriteHeight (u16 sprite, u16 height)
 Changes the height of a 3D sprite.
 
static void PA_3DSetSpriteWidthHeight (u16 sprite, u16 width, u16 height)
 Changes the size of a 3D sprite.
 
static void PA_3DSetSpriteHflip (u16 sprite, u8 hflip)
 Sets the HFlip of a 3D sprite.
 
static void PA_3DSetSpriteVflip (u16 sprite, u8 vflip)
 Sets the VFlip of a 3D sprite.
 
static u8 PA_3DSpriteTouched (u16 sprite)
 Retrives if a 3D sprite is being touched by the stylus.
 
static void PA_3DSetSpriteTex (u16 sprite, u16 texture)
 Sets the texture of a 3D sprite.
 
static void PA_3DSetSpritePal (u16 sprite, u16 palette)
 Sets the palette of a 3D sprite.
 
void PA_3DSetSpriteFrame (u16 sprite, u16 frame)
 Sets the animation frame of a 3D sprite.
 
static void PA_3DSetSpriteTopLeft (u16 sprite, s16 x, s16 y)
 Sets the top left corner of a 3D sprite.
 
static void PA_3DSetSpriteTopRight (u16 sprite, s16 x, s16 y)
 Sets the top right corner of a 3D sprite.
 
static void PA_3DSetSpriteBottomLeft (u16 sprite, s16 x, s16 y)
 Sets the bottom left corner of a 3D sprite.
 
static void PA_3DSetSpriteBottomRight (u16 sprite, s16 x, s16 y)
 Sets the bottom right corner of a 3D sprite.
 
static void PA_3DSetSpritePrio (u16 sprite, u16 priority)
 Sets the priority of a 3D sprite.
 
static void PA_3DSetSpritePolyID (u16 sprite, u8 polyID)
 Sets the PolyID of a 3D sprite.
 
static void PA_3DSetSpriteAlpha (u16 sprite, u8 alpha)
 Sets the alpha value of a 3D sprite.
 
void PA_3DStartSpriteAnimEx (u16 sprite, s16 firstframe, s16 lastframe, s16 speed, u8 type, s16 ncycles)
 Start a 3D sprite animation. Once started, it continues on and on by itself until you stop it !
 
static void PA_3DStartSpriteAnim (u16 sprite, s16 firstframe, s16 lastframe, s16 speed)
 Start a sprite animation. Once started, it continues on and on by itself until you stop it !
 
static void PA_3DStopSpriteAnim (u16 sprite)
 Stop a sprite animation.
 
static void PA_3DSetSpriteAnimFrame (u16 sprite, u16 frame)
 Set the current animation frame number.
 
static u16 PA_3DGetSpriteAnimFrame (u16 sprite)
 Returns the current animation frame number.
 
static void PA_3DSetSpriteAnimSpeed (u16 sprite, s16 speed)
 Set the current animation speed.
 
static u16 PA_3DGetSpriteAnimSpeed (u16 sprite)
 Returns the current animation speed.
 
static void PA_3DSetSpriteNCycles (u16 sprite, s16 NCycles)
 Set the current animation cycles left (-1 for inifinite loop)
 
static u16 PA_3DGetSpriteNCycles (u16 sprite)
 Returns the current number of animation cycles left.
 
static void PA_3DSpriteAnimPause (u16 sprite, u8 pause)
 Pause or UnPause a sprite animation.
 
static s32 PA_3DGetSpriteX (u16 sprite)
 Gets the X value of a 3D sprite.
 
static s32 PA_3DGetSpriteY (u16 sprite)
 Gets the Y value of a 3D sprite.
 
static void PA_3DSetSpriteVisible (u16 sprite, u8 visible)
 Retrieves if a 3D sprite is visible.
 

Detailed Description

Sprites on one screen using the DS's 3D GPU

Function Documentation

◆ PA_3DStartSpriteAnimEx()

void PA_3DStartSpriteAnimEx ( u16  sprite,
s16  firstframe,
s16  lastframe,
s16  speed,
u8  type,
s16  ncycles 
)

Start a 3D sprite animation. Once started, it continues on and on by itself until you stop it !

Parameters
spritesprite number in the sprite system
firstframeFirst frame of the animation sequence, most of the time 0...
lastframeLast frame to be displayed. When it gets there, it loops back to the first frame
speedSpeed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame
typeDefines how you want it to loop. ANIM_LOOP (0) for a normal loop, ANIM_UPDOWN (1) for back and forth animation.
ncyclesNumber of animation cycles before stopping. If using ANIM_UPDOWN, it takes 2 cycles to come back to the original image

◆ PA_3DStartSpriteAnim()

static inline void PA_3DStartSpriteAnim ( u16  sprite,
s16  firstframe,
s16  lastframe,
s16  speed 
)
inlinestatic

Start a sprite animation. Once started, it continues on and on by itself until you stop it !

Parameters
spritesprite number in the sprite system
firstframeFirst frame of the animation sequence, most of the time 0...
lastframeLast frame to be displayed. When it gets there, it loops back to the first frame
speedSpeed, in frames per second. So speed 1 would mean 1 image per second, so 1 image every game frame

◆ PA_3DStopSpriteAnim()

static inline void PA_3DStopSpriteAnim ( u16  sprite)
inlinestatic

Stop a sprite animation.

Parameters
spritesprite number in the sprite system

◆ PA_3DSetSpriteAnimFrame()

static inline void PA_3DSetSpriteAnimFrame ( u16  sprite,
u16  frame 
)
inlinestatic

Set the current animation frame number.

Parameters
spritesprite number in the sprite system
frameFrame number to use...

◆ PA_3DGetSpriteAnimFrame()

static inline u16 PA_3DGetSpriteAnimFrame ( u16  sprite)
inlinestatic

Returns the current animation frame number.

Parameters
spritesprite number in the sprite system

◆ PA_3DSetSpriteAnimSpeed()

static inline void PA_3DSetSpriteAnimSpeed ( u16  sprite,
s16  speed 
)
inlinestatic

Set the current animation speed.

Parameters
spritesprite number in the sprite system
speedSpeed, in fps...

◆ PA_3DGetSpriteAnimSpeed()

static inline u16 PA_3DGetSpriteAnimSpeed ( u16  sprite)
inlinestatic

Returns the current animation speed.

Parameters
spritesprite number in the sprite system

◆ PA_3DSetSpriteNCycles()

static inline void PA_3DSetSpriteNCycles ( u16  sprite,
s16  NCycles 
)
inlinestatic

Set the current animation cycles left (-1 for inifinite loop)

Parameters
spritesprite number in the sprite system
NCyclesNumber of cycles

◆ PA_3DGetSpriteNCycles()

static inline u16 PA_3DGetSpriteNCycles ( u16  sprite)
inlinestatic

Returns the current number of animation cycles left.

Parameters
spritesprite number in the sprite system

◆ PA_3DSpriteAnimPause()

static inline u16 PA_3DSpriteAnimPause ( u16  sprite,
u8  pause 
)
inlinestatic

Pause or UnPause a sprite animation.

Parameters
spritesprite number in the sprite system
pause1 for pause, 0 for unpause