Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_anim.h
Go to the documentation of this file.
1
9#ifndef __N_ANIM_HEADER
10#define __N_ANIM_HEADER
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include "n_common.h"
17#include "n_log.h"
18#include "n_str.h"
19#include "allegro5/allegro.h"
20
27typedef struct ANIM_FRAME {
28 int x,
30 unsigned int duration;
32
34typedef struct ANIM_GFX {
38 ALLEGRO_BITMAP* bmp;
39
41 unsigned int type,
48} ANIM_GFX;
49
51typedef struct ANIM_LIB {
54
56 unsigned int nb_max_gfxs;
57
59 char* name;
60} ANIM_LIB;
61
63typedef struct ANIM_DATA {
64 unsigned int id,
73
76} ANIM_DATA;
77
78ANIM_LIB* create_anim_library(char* name, unsigned int size);
79int delete_bmp_from_lib(ANIM_LIB* lib, unsigned int id);
80int add_bmp_to_lib(ANIM_LIB* lib, unsigned int pos, char* file, char* resfile);
81int update_anim(ANIM_DATA* data, unsigned int delta_t);
82int draw_anim(ANIM_DATA* data, int x, int y);
83int destroy_anim_lib(ANIM_LIB** lib);
84
89#ifdef __cplusplus
90}
91#endif
92
93#endif // header guard
unsigned int nb_frames
nb frames in anim
Definition n_anim.h:47
unsigned int type
blit type: masked with color, blended, brut
Definition n_anim.h:41
int y
Definition n_anim.h:29
unsigned int w
width of a frame
Definition n_anim.h:43
unsigned int id
Definition n_anim.h:64
unsigned int duration
Definition n_anim.h:30
unsigned int elapsed
elapsed time since last frame change
Definition n_anim.h:72
char * name
name of the anim library
Definition n_anim.h:59
ANIM_GFX ** gfxs
Stack of gfxs.
Definition n_anim.h:53
unsigned int h
height of a frame
Definition n_anim.h:45
ANIM_FRAME * frames
each frame properties
Definition n_anim.h:36
unsigned int y
y coordinate of the animation
Definition n_anim.h:68
int x
Definition n_anim.h:28
unsigned int frame
id of the current frame
Definition n_anim.h:70
ALLEGRO_BITMAP * bmp
bitmap with a list of lil' bitmap inside
Definition n_anim.h:38
unsigned int x
x coordinate of the animation
Definition n_anim.h:66
ANIM_LIB * lib
pointer to an anim gfx library
Definition n_anim.h:75
unsigned int nb_max_gfxs
size of the stack
Definition n_anim.h:56
int delete_bmp_from_lib(ANIM_LIB *lib, unsigned int id)
Delete the frame at 'id' from 'lib'.
Definition n_anim.c:67
int add_bmp_to_lib(ANIM_LIB *lib, unsigned int pos, char *file, char *resfile)
add a bitmap to a ANIM_LIB *lib
Definition n_anim.c:83
int draw_anim(ANIM_DATA *data, int x, int y)
blit an ANIM_DATA at position x,y ( current selected video buffer is used )
Definition n_anim.c:188
ANIM_LIB * create_anim_library(char *name, unsigned int size)
Allocate an animation library.
Definition n_anim.c:19
int update_anim(ANIM_DATA *data, unsigned int delta_t)
compute and update an ANIM_DATA context based on elapsed delta_t time in usecs
Definition n_anim.c:168
int destroy_anim_lib(ANIM_LIB **lib)
Destroy an animation library.
Definition n_anim.c:51
animation properties
Definition n_anim.h:63
struct of the properties of a frame in an animation
Definition n_anim.h:27
struct of an animation
Definition n_anim.h:34
structure of a library of gfxs
Definition n_anim.h:51
Common headers and low-level functions & define.
Generic log system.
N_STR and string function declaration.