6 Module ANIM_LIB
gullradriel edited this page 2026-10-29 20:54:40 +01:00

GRAPHICS: animation library, loading structures and blit funcs

Structures

Name
struct ANIM_LIB
structure of a library of gfxs
struct ANIM_GFX
struct of an animation
struct ANIM_FRAME
struct of the properties of a frame in an animation
struct ANIM_DATA
animation properties

Functions

Name
int update_anim(ANIM_DATA * data, unsigned int delta_t)
update animation frame
int draw_anim(ANIM_DATA * data, int x, int y)
draw current animation frame
int destroy_anim_lib(ANIM_LIB ** lib)
destroy an animation library
int delete_bmp_from_lib(ANIM_LIB * lib, unsigned int id)
delete a bitmap from the library
ANIM_LIB * create_anim_library(const char * name, unsigned int size)
create a new animation library
int add_bmp_to_lib(ANIM_LIB * lib, unsigned int pos, char * file, char * resfile)
add a bitmap to the library

Functions Documentation

function update_anim

int update_anim(
    ANIM_DATA * data,
    unsigned int delta_t
)

update animation frame

Parameters:

  • data targetted ANIM_DATA
  • delta_t elapsed time to apply (usecs)

Return: TRUE or FALSE

compute and update an ANIM_DATA context based on elapsed delta_t time in usecs

update animation frame

function draw_anim

int draw_anim(
    ANIM_DATA * data,
    int x,
    int y
)

draw current animation frame

Parameters:

  • data ANIM_DATA *source to use
  • x x position on screen
  • y y position on screen

Return: TRUE or FALSE

blit an ANIM_DATA at position x,y ( current selected video buffer is used )

draw current animation frame

function destroy_anim_lib

int destroy_anim_lib(
    ANIM_LIB ** lib
)

destroy an animation library

Parameters:

  • lib animation library to destroy

Return: TRUE or FALSE

Destroy an animation library.

destroy an animation library

function delete_bmp_from_lib

int delete_bmp_from_lib(
    ANIM_LIB * lib,
    unsigned int id
)

delete a bitmap from the library

Parameters:

  • lib Target animation stream
  • id Id of the frame to delete

Return: TRUE or FALSE

Delete the frame at 'id' from 'lib'.

delete a bitmap from the library

function create_anim_library

ANIM_LIB * create_anim_library(
    const char * name,
    unsigned int size
)

create a new animation library

Parameters:

  • name Name for the library or NULL (in which case 'generic_name' will be assigned)
  • size Number of animations

Return: An allocated ANIM_LIB *object or NULL

Allocate an animation library.

create a new animation library

function add_bmp_to_lib

int add_bmp_to_lib(
    ANIM_LIB * lib,
    unsigned int pos,
    char * file,
    char * resfile
)

add a bitmap to the library

Parameters:

  • lib targetted library
  • pos position in the animation library
  • file input bitmap file
  • resfile associated input bitmap text file

Return: TRUE or FALSE

add a bitmap to a ANIM_LIB *lib

add a bitmap to the library