Jo Engine  9
Jo Sega Saturn Engine
Data Structures | Enumerations | Functions | Variables
sprite_animator.h File Reference

Jo Engine Sprite Animator. More...

Go to the source code of this file.

Data Structures

struct  jo_sprite_anim
 Internal animation struct. More...
 

Enumerations

enum  jo_sprite_anim_action { JO_SPRITE_ANIM_START, JO_SPRITE_ANIM_START_REVERSE, JO_SPRITE_ANIM_STOP, JO_SPRITE_ANIM_STOP_AT_LAST_FRAME }
 Animation action. More...
 

Functions

static __jo_force_inline unsigned char jo_get_sprite_anim_frame_rate (const int anim_id)
 Get animation frame rate. More...
 
static __jo_force_inline unsigned short jo_get_sprite_anim_frame_count (const int anim_id)
 Get animation frame count. More...
 
static __jo_force_inline unsigned short jo_get_sprite_anim_frame (const int anim_id)
 Get current animation frame. More...
 
static __jo_force_inline void jo_set_sprite_anim_frame (const int anim_id, const unsigned char frame)
 Set animation frame. More...
 
static __jo_force_inline void jo_start_sprite_anim_loop (const int anim_id)
 Start animation loop. More...
 
static __jo_force_inline bool jo_is_sprite_anim_stopped (const int anim_id)
 Determine if the animation is stopped. More...
 
static __jo_force_inline void jo_stop_sprite_anim (const int anim_id)
 Stop animation. More...
 
static __jo_force_inline void jo_start_sprite_anim (const int anim_id)
 Start animation and stop it at the last frame. More...
 
static __jo_force_inline void jo_reset_sprite_anim (const int anim_id)
 Stop animation and reset the animation to the first frame. More...
 
static __jo_force_inline void jo_restart_sprite_anim (const int anim_id)
 Restart animation and stop it at the last frame. More...
 
static __jo_force_inline int jo_get_anim_sprite (const int anim_id)
 Get the sprite to display according to the animation (current frame) More...
 
static __jo_force_inline int jo_get_anim_sprite_reverse (const int anim_id)
 Get the sprite to display according to the animation in reverse (current frame) More...
 
static __jo_force_inline int jo_set_sprite_anim_frame_rate (const int anim_id, const unsigned char framerate)
 Set animation framerate. More...
 
int jo_replace_sprite_anim (const int at, const unsigned short sprite_id, const unsigned short frame_count, const unsigned char frame_rate)
 Replace an existing animation. More...
 
int jo_create_sprite_anim (const unsigned short sprite_id, const unsigned short frame_count, const unsigned char frame_rate)
 Create an animation. More...
 
void jo_clear_all_sprite_anim (void)
 Clear all sprite animation. More...
 

Variables

jo_sprite_anim __jo_sprite_anim_tab [JO_MAX_SPRITE_ANIM]
 Internal animation table. More...
 

Detailed Description

Jo Engine Sprite Animator.

Author
Johannes Fetz
Bug:
No known bugs.

Data Structure Documentation

struct jo_sprite_anim

Internal animation struct.

Data Fields
jo_sprite_anim_action action
unsigned short cur_frame
unsigned short frame0_sprite_id
unsigned short frame_count
unsigned char frame_rate
unsigned char frame_skip

Enumeration Type Documentation

Animation action.

Enumerator
JO_SPRITE_ANIM_START 
JO_SPRITE_ANIM_START_REVERSE 
JO_SPRITE_ANIM_STOP 
JO_SPRITE_ANIM_STOP_AT_LAST_FRAME 

Function Documentation

void jo_clear_all_sprite_anim ( void  )

Clear all sprite animation.

int jo_create_sprite_anim ( const unsigned short  sprite_id,
const unsigned short  frame_count,
const unsigned char  frame_rate 
)

Create an animation.

Parameters
sprite_idFirst sprite id returned by jo_sprite_add() or similar functions
frame_countNumber of frame in the animation (number of continious sprite)
frame_rateFramerate (linked to the global framerate)
Returns
-1 if failed or Animation Id (ANIM_ID)
static __jo_force_inline int jo_get_anim_sprite ( const int  anim_id)
static

Get the sprite to display according to the animation (current frame)

Parameters
anim_idId returned by jo_create_sprite_anim()
static __jo_force_inline int jo_get_anim_sprite_reverse ( const int  anim_id)
static

Get the sprite to display according to the animation in reverse (current frame)

Parameters
anim_idId returned by jo_create_sprite_anim()
static __jo_force_inline unsigned short jo_get_sprite_anim_frame ( const int  anim_id)
static

Get current animation frame.

Parameters
anim_idId returned by jo_create_sprite_anim()
Returns
animation frame index (from 0 to "number of sprite in animation")
static __jo_force_inline unsigned short jo_get_sprite_anim_frame_count ( const int  anim_id)
static

Get animation frame count.

Parameters
anim_idId returned by jo_create_sprite_anim()
Returns
animation frame index (from 0 to "number of sprite in animation")
static __jo_force_inline unsigned char jo_get_sprite_anim_frame_rate ( const int  anim_id)
static

Get animation frame rate.

Parameters
anim_idId returned by jo_create_sprite_anim()
Returns
animation frame index (from 0 to "number of sprite in animation")
static __jo_force_inline bool jo_is_sprite_anim_stopped ( const int  anim_id)
static

Determine if the animation is stopped.

Parameters
anim_idId returned by jo_create_sprite_anim()
Returns
true if the animation is stopped otherwise false
int jo_replace_sprite_anim ( const int  at,
const unsigned short  sprite_id,
const unsigned short  frame_count,
const unsigned char  frame_rate 
)

Replace an existing animation.

Parameters
atId returned by jo_create_sprite_anim()
sprite_idFirst sprite id returned by jo_sprite_add() or similar functions
frame_countNumber of frame in the animation (number of continious sprite)
frame_rateFramerate (linked to the global framerate)
Returns
-1 if failed or the "at" param
static __jo_force_inline void jo_reset_sprite_anim ( const int  anim_id)
static

Stop animation and reset the animation to the first frame.

Parameters
anim_idId returned by jo_create_sprite_anim()
static __jo_force_inline void jo_restart_sprite_anim ( const int  anim_id)
static

Restart animation and stop it at the last frame.

Parameters
anim_idId returned by jo_create_sprite_anim()
static __jo_force_inline void jo_set_sprite_anim_frame ( const int  anim_id,
const unsigned char  frame 
)
static

Set animation frame.

Parameters
anim_idId returned by jo_create_sprite_anim()
frameFrame of animation to be displayed, where 0 is the first frame.
static __jo_force_inline int jo_set_sprite_anim_frame_rate ( const int  anim_id,
const unsigned char  framerate 
)
static

Set animation framerate.

Parameters
anim_idId returned by jo_create_sprite_anim()
framerateFrame rate (linked to the global framerate)
static __jo_force_inline void jo_start_sprite_anim ( const int  anim_id)
static

Start animation and stop it at the last frame.

Parameters
anim_idId returned by jo_create_sprite_anim()
static __jo_force_inline void jo_start_sprite_anim_loop ( const int  anim_id)
static

Start animation loop.

Parameters
anim_idId returned by jo_create_sprite_anim()
static __jo_force_inline void jo_stop_sprite_anim ( const int  anim_id)
static

Stop animation.

Parameters
anim_idId returned by jo_create_sprite_anim()

Variable Documentation

jo_sprite_anim __jo_sprite_anim_tab[JO_MAX_SPRITE_ANIM]

Internal animation table.

Warning
MC Hammer: don't touch this