Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
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#include "n_common.h"
28#include "n_log.h"
29#include "n_list.h"
30#include "n_3d.h"
31#include "n_time.h"
32
34#define NORMAL_PART 0
36#define SINUS_PART 1
38#define TRANS_PART 2
40#define SNOW_PART 3
42#define FIRE_PART 4
44#define STAR_PART 5
46#define CIRCLE_PART 6
48#define PIXEL_PART 7
50#define BITMAP_PART 8
52#define TEXT_PART 9
53
55typedef struct PARTICLE {
57 int mode,
64
66 ALLEGRO_COLOR color;
67
70
71} PARTICLE;
72
74typedef struct PARTICLE_SYSTEM {
77
80
83
85 ALLEGRO_BITMAP** sprites;
89
90int init_particle_system(PARTICLE_SYSTEM** psys, int max, double x, double y, double z, int max_sprites);
91
92int add_particle(PARTICLE_SYSTEM* psys, int spr, int mode, int lifetime, int size, ALLEGRO_COLOR color, PHYSICS object);
93int 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);
94
95int manage_particle_ex(PARTICLE_SYSTEM* psys, double delta_t);
96
98
99int draw_particle(PARTICLE_SYSTEM* psys, double xpos, double ypos, int w, int h, double range);
100
102
103int move_particles(PARTICLE_SYSTEM* psys, double vx, double vy, double vz);
104
109#ifdef __cplusplus
110}
111#endif
112
113#endif /* PARTICLE_HEADER_FOR_CHRISTMASHACK */
Structure of a generic LIST container.
Definition n_list.h:39
Timing Structure.
Definition n_time.h:32
N_TIME timer
Internal: particle system timer.
Definition n_particles.h:82
int size
size of particle
Definition n_particles.h:63
int max_sprites
size of the picture library
Definition n_particles.h:87
ALLEGRO_COLOR color
color of the particle
Definition n_particles.h:66
PHYSICS object
particle physical properties
Definition n_particles.h:69
int spr_id
sprite id in library
Definition n_particles.h:61
int lifetime
lifetime
Definition n_particles.h:59
VECTOR3D source
Coordinate of emitting point.
Definition n_particles.h:79
LIST * list
list of PARTICLE pointers
Definition n_particles.h:76
int mode
particle mode: NORMAL_PART,SINUS_PART,PIXEL_PART
Definition n_particles.h:57
ALLEGRO_BITMAP ** sprites
Library of picture for the particles.
Definition n_particles.h:85
int draw_particle(PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range)
draw particles of a particle system
int move_particles(PARTICLE_SYSTEM *psys, double vx, double vy, double vz)
draw particles of a particle system
int manage_particle_ex(PARTICLE_SYSTEM *psys, double delta_t)
update particles positions usting provided delta time
int free_particle_system(PARTICLE_SYSTEM **psys)
destroy and free a particle system
int manage_particle(PARTICLE_SYSTEM *psys)
update particles positions usting particle system internal timer
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:97
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:53
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:21
Structure of a single particle.
Definition n_particles.h:55
Structure of a particle system.
Definition n_particles.h:74
double VECTOR3D[3]
struct of a point
Definition n_3d.h:39
structure of the physics of an object
Definition n_3d.h:48
Simple 3D movement simulation.
Common headers and low-level functions & define.
List structures and definitions.
Generic log system.
Timing utilities.