Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
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 int x,
28 y;
29 unsigned int duration;
31
33typedef struct ANIM_GFX {
37 ALLEGRO_BITMAP* bmp;
38
40 unsigned int type,
47} ANIM_GFX;
48
50typedef struct ANIM_LIB {
53
55 unsigned int nb_max_gfxs;
56
58 char* name;
59} ANIM_LIB;
60
62typedef struct ANIM_DATA {
63 unsigned int id,
72
75} ANIM_DATA;
76
77ANIM_LIB* create_anim_library(char* name, unsigned int size);
78int delete_bmp_from_lib(ANIM_LIB* lib, unsigned int id);
79int add_bmp_to_lib(ANIM_LIB* lib, unsigned int pos, char* file, char* resfile);
80int update_anim(ANIM_DATA* data, unsigned int delta_t);
81int draw_anim(ANIM_DATA* data, int x, int y);
82int destroy_anim_lib(ANIM_LIB** lib);
83
88#ifdef __cplusplus
89}
90#endif
91
92#endif // header guard
unsigned int nb_frames
nb frames in anim
Definition n_anim.h:46
unsigned int type
blit type: masked with color, blended, brut
Definition n_anim.h:40
unsigned int w
width of a frame
Definition n_anim.h:42
unsigned int elapsed
elapsed time since last frame change
Definition n_anim.h:71
char * name
name of the anim library
Definition n_anim.h:58
ANIM_GFX ** gfxs
Stack of gfxs.
Definition n_anim.h:52
unsigned int h
height of a frame
Definition n_anim.h:44
ANIM_FRAME * frames
each frame properties
Definition n_anim.h:35
unsigned int y
y coordinate of the animation
Definition n_anim.h:67
unsigned int frame
id of the current frame
Definition n_anim.h:69
ALLEGRO_BITMAP * bmp
bitmap with a list of lil' bitmap inside
Definition n_anim.h:37
unsigned int x
x coordinate of the animation
Definition n_anim.h:65
ANIM_LIB * lib
pointer to an anim gfx library
Definition n_anim.h:74
unsigned int nb_max_gfxs
size of the stack
Definition n_anim.h:55
int delete_bmp_from_lib(ANIM_LIB *lib, unsigned int id)
Delete the frame at 'id' from 'lib'.
Definition n_anim.c:66
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:82
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:187
ANIM_LIB * create_anim_library(char *name, unsigned int size)
Allocate an animation library.
Definition n_anim.c:18
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:167
int destroy_anim_lib(ANIM_LIB **lib)
Destroy an animation library.
Definition n_anim.c:50
animation properties
Definition n_anim.h:62
struct of the properties of a frame in an animation
Definition n_anim.h:26
struct of an animation
Definition n_anim.h:33
structure of a library of gfxs
Definition n_anim.h:50
Common headers and low-level functions & define.
Generic log system.
N_STR and string function declaration.