Nilorea Library

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros Groups
n_particles.h
Go to the documentation of this file.
1
15 #ifndef NILOREA_PARTICLE_HEADER_
16 #define NILOREA_PARTICLE_HEADER_
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #include "n_common.h"
23 #include "n_log.h"
24 #include "n_common.h"
25
26
27 #define NORMAL_PART 0
28 #define SINUS_PART 1
29 #define TRANS_PART 2
30
31
32 typedef struct PARTICLE
33 {
34 double x , y , z ,
35 ax , ay , az ,
36 vx , vy , vz ;
37
38 BITMAP *sprite ;
39
40 int mode ,
41 off_x , off_y ,
42 lifetime ,
43 color;
44
45 struct PARTICLE *next ,
46 *prev ;
47
48 } PARTICLE ;
49
50 typedef struct PARTICLE_SYSTEM
51 {
52 PARTICLE *list_start , *list_end ;
53
54 double x , y , z ;
55
56 N_TIME timer ;
57
58 int max_particles,
59 nb_particles ;
60
61 }PARTICLE_SYSTEM ;
62
64 #define particle_foreach( __ITEM_ , __PARTICLE_SYSTEM_ ) \
65 if( !__PARTICLE_SYSTEM_ ) \
66 { \
67 n_log( LOG_ERR , "Error in particle_foreach, %s is NULL" , #__PARTICLE_SYSTEM_ ); \
68 } \
69 else \
70 for( PARTICLE *__ITEM_ = __PARTICLE_SYSTEM_ -> list_start ; __ITEM_ != NULL; __ITEM_ = __ITEM_ -> next ) \
71
72
73 int init_particle_system( PARTICLE_SYSTEM **psys , int max , double x , double y , double z );
74
75 int add_particle( PARTICLE_SYSTEM *psys , BITMAP *spr , int mode , int off_x , int off_y , int lifetime , int color ,
76 double vx , double vy , double vz ,
77 double ax , double ay , double az );
78
79 int manage_particle( PARTICLE_SYSTEM *psys);
80
81 int draw_particle( BITMAP *bmp , PARTICLE_SYSTEM *psys );
82
83 int free_particle( PARTICLE_SYSTEM *psys , PARTICLE **ptr );
84
85 int free_particle_system( PARTICLE_SYSTEM **psys);
86
87 #ifdef __cplusplus
88 }
89 #endif
90 #endif /* NILOREA_PARTICLE_HEADER_ */
91