Jo Engine  2024.04.28
Jo Sega Saturn Engine
Data Structures | Macros | Functions
storyboard.h File Reference

Jo Engine Storyboard Animation function prototypes. More...

Go to the source code of this file.

Data Structures

struct  jo_storyboard_object_cache
 Internal object cache. More...
 
struct  jo_animation
 Object animation definition. More...
 
struct  jo_storyboard
 Storyboard definition. More...
 

Macros

#define JO_STORYBOARD_INFINITE_DURATION
 Specify that the animation is infinite. More...
 

Functions

jo_storyboardjo_storyboard_create (const bool autoplay, const bool repeat)
 Create an empty storyboard. More...
 
void jo_storyboard_destroy (jo_storyboard *const storyboard)
 Destroy the storyboard. More...
 
jo_animationjo_storyboard_create_animation (jo_storyboard *const storyboard, const unsigned char frame_skip, const unsigned int duration)
 Create an empty animation. More...
 
static __jo_force_inline void jo_storyboard_destroy_animation (jo_storyboard *const storyboard, const jo_animation *const animation)
 Destroy animation. More...
 
static __jo_force_inline void jo_storyboard_repeat (jo_storyboard *const storyboard, bool repeat)
 Storyboard repeat control. More...
 
static __jo_force_inline void jo_storyboard_suspend (jo_storyboard *const storyboard)
 Suspend all storyboard animation. More...
 
static __jo_force_inline void jo_storyboard_resume (jo_storyboard *const storyboard)
 Resume all suspended storyboard animation. More...
 
static __jo_force_inline void jo_storyboard_play (jo_storyboard *const storyboard)
 Play storyboard animation. More...
 
static __jo_force_inline void jo_storyboard_toggle (jo_storyboard *const storyboard)
 Switch between resume and suspend. More...
 
static __jo_force_inline void jo_storyboard_add_object (jo_storyboard *const storyboard, const void *const object)
 Add object in storyboard. More...
 
static __jo_force_inline void jo_storyboard_remove_object (jo_storyboard *const storyboard, const void *const object)
 Remove object from storyboard. More...
 
static __jo_force_inline jo_storyboard_object_cachejo_storyboard_get_object_cache (jo_storyboard *const storyboard, const void *const object)
 Get object storyboard cache. More...
 
static __jo_force_inline void jo_storyboard_reset_object_position (jo_storyboard *const storyboard, const void *const object)
 Reset object position. More...
 
static __jo_force_inline jo_storyboardjo_storyboard_create_for_object (const bool autoplay, const bool repeat, const void *const object)
 Create a new storyboard for the object. More...
 
static __jo_force_inline jo_animationjo_storyboard_create_rotation_animation (jo_storyboard *const storyboard, const char speed, const unsigned int duration)
 Create a rotation animation. More...
 
static __jo_force_inline jo_animationjo_storyboard_create_translation_animation (jo_storyboard *const storyboard, const short angle, const char speed, const unsigned int duration)
 Create a translation animation. More...
 
static __jo_force_inline jo_animationjo_storyboard_create_translation_animation_using_direction (jo_storyboard *const storyboard, const jo_8_directions direction, const char speed, const unsigned int duration)
 Create a translation animation using jo_8_directions enum. More...
 
static __jo_force_inline jo_animationjo_storyboard_create_circle_animation (jo_storyboard *const storyboard, const short radius, const char speed, const unsigned int duration)
 Create a circle rotation animation. More...
 
static __jo_force_inline jo_storyboardjo_storyboard_rotate_object (const void *const object, const char speed, const unsigned int duration)
 Create a rotation animation storyboard for a specific object. More...
 
static __jo_force_inline jo_storyboardjo_storyboard_move_object (const void *const object, const short angle, const char speed, const unsigned int duration)
 Create a translation animation storyboard for a specific object. More...
 
static __jo_force_inline jo_storyboardjo_storyboard_move_object_in_direction (const void *const object, const jo_8_directions direction, const char speed, const unsigned int duration)
 Create a translation animation storyboard for a specific object using jo_8_directions enum. More...
 
static __jo_force_inline jo_storyboardjo_storyboard_move_object_in_circle (const void *const object, const short radius, const char speed, const unsigned int duration)
 Create a circle rotation storyboard for a specific object. More...
 

Detailed Description

Jo Engine Storyboard Animation function prototypes.

Author
Johannes Fetz
Bug:
No known bugs.

Data Structure Documentation

◆ jo_storyboard_object_cache

struct jo_storyboard_object_cache

Internal object cache.

Warning
MC Hammer: don't touch this
Data Fields
short current_cos
short current_sin
int dx
int dy
jo_3d_object_attributes * user

◆ jo_animation

struct jo_animation

Object animation definition.

Data Fields
short cos_radius
unsigned int count
short direction
bool disabled
unsigned short frame
unsigned char frame_skip
unsigned int limit
char rotation_speed
short sin_radius
char translation_speed_x
char translation_speed_y

◆ jo_storyboard

struct jo_storyboard

Storyboard definition.

Remarks
A storyboard could contains multiple animation on multiple object
Data Fields
jo_list animations
jo_list objects
bool pause
bool repeat

Macro Definition Documentation

◆ JO_STORYBOARD_INFINITE_DURATION

#define JO_STORYBOARD_INFINITE_DURATION

Specify that the animation is infinite.

Remarks
For jo_storyboard_create_animation() and other helper

Function Documentation

◆ jo_storyboard_add_object()

static __jo_force_inline void jo_storyboard_add_object ( jo_storyboard *const  storyboard,
const void *const  object 
)
static

Add object in storyboard.

Parameters
storyboardStoryboard
objectPointer to an object (jo_pos2D, jo_pos3D, jo_2d_object_attributes or jo_3d_object_attributes)
Remarks
You can pass any structure (even an array) if you respect the order of attributes

◆ jo_storyboard_create()

jo_storyboard* jo_storyboard_create ( const bool  autoplay,
const bool  repeat 
)

Create an empty storyboard.

Parameters
autoplayPlay the storyboard immediately
repeatPlay the storyboard in loop (each animation must have a limited duration)
Returns
An empty storyboard
Warning
repeat only works if all animation inside storyboard have a limited duration
See also
jo_storyboard_destroy()

◆ jo_storyboard_create_animation()

jo_animation* jo_storyboard_create_animation ( jo_storyboard *const  storyboard,
const unsigned char  frame_skip,
const unsigned int  duration 
)

Create an empty animation.

Parameters
storyboardStoryboard
frame_skipNumber of frame to skip (slowdown animation but preserve CPU)
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
An empty animation
See also
jo_storyboard_destroy_animation()
jo_storyboard_create()

◆ jo_storyboard_create_circle_animation()

static __jo_force_inline jo_animation* jo_storyboard_create_circle_animation ( jo_storyboard *const  storyboard,
const short  radius,
const char  speed,
const unsigned int  duration 
)
static

Create a circle rotation animation.

Parameters
storyboardStoryboard
radiusCircle radius
speedTranslation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
The animation

◆ jo_storyboard_create_for_object()

static __jo_force_inline jo_storyboard* jo_storyboard_create_for_object ( const bool  autoplay,
const bool  repeat,
const void *const  object 
)
static

Create a new storyboard for the object.

Parameters
autoplayPlay the storyboard immediately
repeatPlay the storyboard in loop (each animation must have a limited duration)
objectPointer to an object (jo_pos2D, jo_pos3D, jo_2d_object_attributes or jo_3d_object_attributes)
Remarks
You can pass any structure (even an array) if you respect the order of attributes
Returns
The storyboard

◆ jo_storyboard_create_rotation_animation()

static __jo_force_inline jo_animation* jo_storyboard_create_rotation_animation ( jo_storyboard *const  storyboard,
const char  speed,
const unsigned int  duration 
)
static

Create a rotation animation.

Parameters
storyboardStoryboard
speedRotation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Remarks
If speed = 1 and duration = 90, the object will make a smooth clockwise rotation of 90°
If speed is positive, the rotation is clockwise otherwise counterclockwise
Returns
The animation

◆ jo_storyboard_create_translation_animation()

static __jo_force_inline jo_animation* jo_storyboard_create_translation_animation ( jo_storyboard *const  storyboard,
const short  angle,
const char  speed,
const unsigned int  duration 
)
static

Create a translation animation.

Parameters
storyboardStoryboard
angleVector direction
speedTranslation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
The animation

◆ jo_storyboard_create_translation_animation_using_direction()

static __jo_force_inline jo_animation* jo_storyboard_create_translation_animation_using_direction ( jo_storyboard *const  storyboard,
const jo_8_directions  direction,
const char  speed,
const unsigned int  duration 
)
static

Create a translation animation using jo_8_directions enum.

Parameters
storyboardStoryboard
directionVector direction
speedTranslation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
The animation

◆ jo_storyboard_destroy()

void jo_storyboard_destroy ( jo_storyboard *const  storyboard)

Destroy the storyboard.

Parameters
storyboardStoryboard to destroy
See also
jo_storyboard_create()

◆ jo_storyboard_destroy_animation()

static __jo_force_inline void jo_storyboard_destroy_animation ( jo_storyboard *const  storyboard,
const jo_animation *const  animation 
)
static

Destroy animation.

Parameters
storyboardStoryboard which contains the animation
animationAnimation to destroy
See also
jo_storyboard_create_animation()

◆ jo_storyboard_get_object_cache()

static __jo_force_inline jo_storyboard_object_cache* jo_storyboard_get_object_cache ( jo_storyboard *const  storyboard,
const void *const  object 
)
static

Get object storyboard cache.

Parameters
storyboardStoryboard
objectPointer to an object (should be the same passed in jo_storyboard_add_object())
Returns
Object storyboard cache

◆ jo_storyboard_move_object()

static __jo_force_inline jo_storyboard* jo_storyboard_move_object ( const void *const  object,
const short  angle,
const char  speed,
const unsigned int  duration 
)
static

Create a translation animation storyboard for a specific object.

Parameters
objectPointer to an object (jo_pos2D, jo_pos3D, jo_2d_object_attributes or jo_3d_object_attributes)
angleVector direction
speedRotation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
The storyboard

◆ jo_storyboard_move_object_in_circle()

static __jo_force_inline jo_storyboard* jo_storyboard_move_object_in_circle ( const void *const  object,
const short  radius,
const char  speed,
const unsigned int  duration 
)
static

Create a circle rotation storyboard for a specific object.

Parameters
objectPointer to an object (jo_pos2D, jo_pos3D, jo_2d_object_attributes or jo_3d_object_attributes)
radiusCircle radius
speedTranslation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
The storyboard

◆ jo_storyboard_move_object_in_direction()

static __jo_force_inline jo_storyboard* jo_storyboard_move_object_in_direction ( const void *const  object,
const jo_8_directions  direction,
const char  speed,
const unsigned int  duration 
)
static

Create a translation animation storyboard for a specific object using jo_8_directions enum.

Parameters
objectPointer to an object (jo_pos2D, jo_pos3D, jo_2d_object_attributes or jo_3d_object_attributes)
directionVector direction
speedRotation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Returns
The storyboard

◆ jo_storyboard_play()

static __jo_force_inline void jo_storyboard_play ( jo_storyboard *const  storyboard)
static

Play storyboard animation.

Parameters
storyboardStoryboard

◆ jo_storyboard_remove_object()

static __jo_force_inline void jo_storyboard_remove_object ( jo_storyboard *const  storyboard,
const void *const  object 
)
static

Remove object from storyboard.

Parameters
storyboardStoryboard
objectPointer to an object (should be the same passed in jo_storyboard_add_object())

◆ jo_storyboard_repeat()

static __jo_force_inline void jo_storyboard_repeat ( jo_storyboard *const  storyboard,
bool  repeat 
)
static

Storyboard repeat control.

Parameters
storyboardStoryboard
repeatRepeat

◆ jo_storyboard_reset_object_position()

static __jo_force_inline void jo_storyboard_reset_object_position ( jo_storyboard *const  storyboard,
const void *const  object 
)
static

Reset object position.

Parameters
storyboardStoryboard
objectPointer to an object (should be the same passed in jo_storyboard_add_object())
Remarks
Must be called if you move the object manually (x, y, z)

◆ jo_storyboard_resume()

static __jo_force_inline void jo_storyboard_resume ( jo_storyboard *const  storyboard)
static

Resume all suspended storyboard animation.

Parameters
storyboardStoryboard

◆ jo_storyboard_rotate_object()

static __jo_force_inline jo_storyboard* jo_storyboard_rotate_object ( const void *const  object,
const char  speed,
const unsigned int  duration 
)
static

Create a rotation animation storyboard for a specific object.

Parameters
objectPointer to an object (jo_pos2D, jo_pos3D, jo_2d_object_attributes or jo_3d_object_attributes)
speedRotation speed
durationDuration of animation (you can pass JO_STORYBOARD_INFINITE_DURATION for infinite)
Remarks
If speed = 1 and duration = 90, the object will make a smooth clockwise rotation of 90°
If speed is positive, the rotation is clockwise otherwise counterclockwise
Returns
The storyboard

◆ jo_storyboard_suspend()

static __jo_force_inline void jo_storyboard_suspend ( jo_storyboard *const  storyboard)
static

Suspend all storyboard animation.

Parameters
storyboardStoryboard

◆ jo_storyboard_toggle()

static __jo_force_inline void jo_storyboard_toggle ( jo_storyboard *const  storyboard)
static

Switch between resume and suspend.

Parameters
storyboardStoryboard