Nilorea Library
C utilities for networking, threading, graphics
n_particles.h
Go to the documentation of this file.
1
8#ifndef __N_PARTICLE_HEADER
9#define __N_PARTICLE_HEADER
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
20#include <allegro5/allegro.h>
21#include <allegro5/allegro_audio.h>
22#include <allegro5/allegro_acodec.h>
23#include <allegro5/allegro_font.h>
24#include <allegro5/allegro_image.h>
25#include <allegro5/allegro_primitives.h>
26
27
28#include "n_common.h"
29#include "n_log.h"
30#include "n_list.h"
31#include "n_3d.h"
32#include "n_time.h"
33
35#define NORMAL_PART 0
37#define SINUS_PART 1
39#define TRANS_PART 2
41#define SNOW_PART 3
43#define FIRE_PART 4
45#define STAR_PART 5
47#define CIRCLE_PART 6
49#define PIXEL_PART 7
51#define BITMAP_PART 8
53#define TEXT_PART 9
54
55
57typedef struct PARTICLE
58{
60 int mode,
67
69 ALLEGRO_COLOR color ;
70
73
74} PARTICLE ;
75
77typedef struct PARTICLE_SYSTEM
78{
81
84
87
89 ALLEGRO_BITMAP **sprites ;
93
94int init_particle_system( PARTICLE_SYSTEM **psys, int max, double x, double y, double z, int max_sprites );
95
96int add_particle( PARTICLE_SYSTEM *psys, int spr, int mode, int lifetime, int size, ALLEGRO_COLOR color, PHYSICS object );
97int add_particle_ex( PARTICLE_SYSTEM *psys, int spr, int mode, int off_x, int off_y, int lifetime, int size, ALLEGRO_COLOR color,
98 double vx, double vy, double vz,
99 double ax, double ay, double az );
100
101int manage_particle_ex( PARTICLE_SYSTEM *psys, double delta_t );
102
104
105int draw_particle( PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range );
106
108
109int move_particles( PARTICLE_SYSTEM *psys, double vx, double vy, double vz );
110
115#ifdef __cplusplus
116}
117#endif
118
119#endif /* PARTICLE_HEADER_FOR_CHRISTMASHACK */
120
Structure of a generic LIST container.
Definition: n_list.h:45
Timing Structure.
Definition: n_time.h:34
N_TIME timer
Internal: particle system timer.
Definition: n_particles.h:86
int size
size of particle
Definition: n_particles.h:66
int max_sprites
size of the picture library
Definition: n_particles.h:91
ALLEGRO_COLOR color
color of the particle
Definition: n_particles.h:69
PHYSICS object
particle physical properties
Definition: n_particles.h:72
int spr_id
sprite id in library
Definition: n_particles.h:64
int lifetime
lifetime
Definition: n_particles.h:62
VECTOR3D source
Coordinate of emitting point.
Definition: n_particles.h:83
LIST * list
list of PARTICLE pointers
Definition: n_particles.h:80
int mode
particle mode: NORMAL_PART,SINUS_PART,PIXEL_PART
Definition: n_particles.h:60
ALLEGRO_BITMAP ** sprites
Library of picture for the particles.
Definition: n_particles.h:89
int draw_particle(PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range)
draw particles of a particle system
Definition: n_particles.c:193
int move_particles(PARTICLE_SYSTEM *psys, double vx, double vy, double vz)
draw particles of a particle system
Definition: n_particles.c:304
int manage_particle_ex(PARTICLE_SYSTEM *psys, double delta_t)
update particles positions usting provided delta time
Definition: n_particles.c:132
int free_particle_system(PARTICLE_SYSTEM **psys)
destroy and free a particle system
Definition: n_particles.c:279
int manage_particle(PARTICLE_SYSTEM *psys)
update particles positions usting particle system internal timer
Definition: n_particles.c:173
int add_particle_ex(PARTICLE_SYSTEM *psys, int spr, int mode, int off_x, int off_y, int lifetime, int size, ALLEGRO_COLOR color, double vx, double vy, double vz, double ax, double ay, double az)
add a particle to a particle system, all in line version (you have to set the PHYSICS object paramete...
Definition: n_particles.c:109
int add_particle(PARTICLE_SYSTEM *psys, int spr, int mode, int lifetime, int size, ALLEGRO_COLOR color, PHYSICS object)
add a particle to a particle system
Definition: n_particles.c:59
int init_particle_system(PARTICLE_SYSTEM **psys, int max, double x, double y, double z, int max_sprites)
initialize a particle system
Definition: n_particles.c:24
Structure of a single particle.
Definition: n_particles.h:58
Structure of a particle system.
Definition: n_particles.h:78
double VECTOR3D[3]
struct of a point
Definition: n_3d.h:39
structure of the physics of an object
Definition: n_3d.h:50
Simple 3D movement simulation.
Common headers and low-level hugly functions & define.
List structures and definitions.
Generic log system.
Timing utilities.