Nilorea Library
C utilities for networking, threading, graphics
n_anim.h
Go to the documentation of this file.
1
8#ifndef __N_ANIM_HEADER
9#define __N_ANIM_HEADER
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#include "n_common.h"
16#include "n_log.h"
17#include "n_str.h"
18#include "allegro5/allegro.h"
19
26typedef struct ANIM_FRAME
27{
28 int x,
29 y;
30 unsigned int duration ;
31} ANIM_FRAME ;
32
34typedef struct ANIM_GFX
35{
39 ALLEGRO_BITMAP *bmp ;
40
42 unsigned int type,
49} ANIM_GFX ;
50
52typedef struct ANIM_LIB
53{
56
58 unsigned int nb_max_gfxs ;
59
61 char *name ;
62} ANIM_LIB ;
63
64
66typedef struct ANIM_DATA
67{
68 unsigned int id,
77
80} ANIM_DATA ;
81
82ANIM_LIB *create_anim_library( char *name, unsigned int size );
83int delete_bmp_from_lib( ANIM_LIB *lib, unsigned int id );
84int add_bmp_to_lib( ANIM_LIB *lib, unsigned int pos, char *file, char *resfile );
85int update_anim( ANIM_DATA *data, unsigned int delta_t );
86int draw_anim( ANIM_DATA *data, int x, int y );
87int destroy_anim_lib( ANIM_LIB **lib );
88
94#ifdef __cplusplus
95}
96#endif
97
98#endif // header guard
99
unsigned int nb_frames
nb frames in anim
Definition: n_anim.h:48
unsigned int type
blit type: masked with color, blended, brut
Definition: n_anim.h:42
unsigned int w
width of a frame
Definition: n_anim.h:44
unsigned int elapsed
elapsed time since last frame change
Definition: n_anim.h:76
char * name
name of the anim library
Definition: n_anim.h:61
ANIM_GFX ** gfxs
Stack of gfxs.
Definition: n_anim.h:55
unsigned int h
height of a frame
Definition: n_anim.h:46
ANIM_FRAME * frames
each frame properties
Definition: n_anim.h:37
unsigned int y
y coordinate of the animation
Definition: n_anim.h:72
unsigned int frame
id of the current frame
Definition: n_anim.h:74
ALLEGRO_BITMAP * bmp
bitmap with a list of lil' bitmap inside
Definition: n_anim.h:39
unsigned int x
x coordinate of the animation
Definition: n_anim.h:70
ANIM_LIB * lib
pointer to an anim gfx library
Definition: n_anim.h:79
unsigned int nb_max_gfxs
size of the stack
Definition: n_anim.h:58
int delete_bmp_from_lib(ANIM_LIB *lib, unsigned int id)
Delete the frame at 'id' from 'lib'.
Definition: n_anim.c:75
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:94
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:181
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:158
int destroy_anim_lib(ANIM_LIB **lib)
Destroy an animation library.
Definition: n_anim.c:56
animation properties
Definition: n_anim.h:67
struct of the properties of a frame in an animation
Definition: n_anim.h:27
struct of an animation
Definition: n_anim.h:35
structure of a library of gfxs
Definition: n_anim.h:53
Common headers and low-level hugly functions & define.
Generic log system.
N_STR and string function declaration.