Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
struct | PARTICLE |
Structure of a single particle. More... | |
struct | PARTICLE_SYSTEM |
Structure of a particle system. More... | |
Macros | |
#define | BITMAP_PART 8 |
bitmap particle More... | |
#define | CIRCLE_PART 6 |
circle particle More... | |
#define | FIRE_PART 4 |
fire particle More... | |
#define | NORMAL_PART 0 |
classic moving particle More... | |
#define | PIXEL_PART 7 |
pixel particle More... | |
#define | SINUS_PART 1 |
sinus based moving particle More... | |
#define | SNOW_PART 3 |
snow particle More... | |
#define | STAR_PART 5 |
star particle More... | |
#define | TEXT_PART 9 |
bitmap particle More... | |
#define | TRANS_PART 2 |
transparent particle More... | |
Functions | |
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 More... | |
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 parameter in the function parameter instead of providing a PHYSICS object) More... | |
int | draw_particle (PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range) |
draw particles of a particle system More... | |
int | free_particle_system (PARTICLE_SYSTEM **psys) |
destroy and free a particle system More... | |
int | init_particle_system (PARTICLE_SYSTEM **psys, int max, double x, double y, double z, int max_sprites) |
initialize a particle system More... | |
int | manage_particle (PARTICLE_SYSTEM *psys) |
update particles positions usting particle system internal timer More... | |
int | manage_particle_ex (PARTICLE_SYSTEM *psys, double delta_t) |
update particles positions usting provided delta time More... | |
int | move_particles (PARTICLE_SYSTEM *psys, double vx, double vy, double vz) |
draw particles of a particle system More... | |
struct PARTICLE |
Structure of a single particle.
Definition at line 57 of file n_particles.h.
Data Fields | ||
---|---|---|
ALLEGRO_COLOR | color | color of the particle |
int | lifetime | lifetime |
int | mode | particle mode: NORMAL_PART,SINUS_PART,PIXEL_PART |
PHYSICS | object | particle physical properties |
int | size | size of particle |
int | spr_id | sprite id in library |
struct PARTICLE_SYSTEM |
Structure of a particle system.
Definition at line 77 of file n_particles.h.
Data Fields | ||
---|---|---|
LIST * | list | list of PARTICLE pointers |
int | max_sprites | size of the picture library |
VECTOR3D | source | Coordinate of emitting point. |
ALLEGRO_BITMAP ** | sprites | Library of picture for the particles. |
N_TIME | timer | Internal: particle system timer. |
#define BITMAP_PART 8 |
bitmap particle
Definition at line 51 of file n_particles.h.
#define CIRCLE_PART 6 |
circle particle
Definition at line 47 of file n_particles.h.
#define FIRE_PART 4 |
fire particle
Definition at line 43 of file n_particles.h.
#define NORMAL_PART 0 |
classic moving particle
Definition at line 35 of file n_particles.h.
#define PIXEL_PART 7 |
#define SINUS_PART 1 |
sinus based moving particle
Definition at line 37 of file n_particles.h.
#define SNOW_PART 3 |
snow particle
Definition at line 41 of file n_particles.h.
#define STAR_PART 5 |
star particle
Definition at line 45 of file n_particles.h.
#define TEXT_PART 9 |
bitmap particle
Definition at line 53 of file n_particles.h.
#define TRANS_PART 2 |
transparent particle
Definition at line 39 of file n_particles.h.
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
psys | targeted particle system |
spr | sprite id of the particle, if any. Set to negative if there is no sprite for the particle |
mode | particle mode, NORMAL_PART:if sprite id then use sprite, else draw a pixel,SINUS_PART: snow moving effect,PIXEL_PART: rectfill with size |
lifetime | duration of the particle in msecs |
size | size of the particle, in pixels |
color | color of the particle |
object | PHYSICS object in which you set the particle initial position, speed, acceleration, rotation |
Definition at line 59 of file n_particles.c.
References __n_assert, list_push(), and Malloc.
Referenced by add_particle_ex().
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 parameter in the function parameter instead of providing a PHYSICS object)
psys | targeted particle system |
spr | sprite id of the particle, if any. Set to negative if there is no sprite for the particle |
mode | particle mode, NORMAL_PART:if sprite id then use sprite, else draw a pixel,SINUS_PART: snow moving effect,PIXEL_PART: rectfill with size |
off_x | x offset from particle source x position |
off_y | y offset from particle source x position |
lifetime | duration of the particle in msecs |
size | size of the particle, in pixels |
color | color of the particle |
vx | x speed of the particle |
vy | vy speed of the particle |
vz | svz peed of the particle |
ax | x acceleration of the particle |
ay | y acceleration of the particle |
az | z acceleration of the particle |
Definition at line 109 of file n_particles.c.
References add_particle(), and VECTOR3D_SET.
int draw_particle | ( | PARTICLE_SYSTEM * | psys, |
double | xpos, | ||
double | ypos, | ||
int | w, | ||
int | h, | ||
double | range | ||
) |
draw particles of a particle system
psys | the targeted particle system |
xpos | camera x position |
ypos | camera y position |
w | width of the current display |
h | height of the current display |
range | display border tolerance, if( ( x < -range ) || ( x > ( w + range ) ) || ( y< -range ) || ( y > ( h + range ) ) ) next ; |
Definition at line 193 of file n_particles.c.
References __n_assert, NORMAL_PART, PIXEL_PART, and SINUS_PART.
int free_particle_system | ( | PARTICLE_SYSTEM ** | psys | ) |
destroy and free a particle system
psys | a pointer to the particle system to destroy |
Definition at line 279 of file n_particles.c.
References __n_assert, Free, and remove_list_node.
int init_particle_system | ( | PARTICLE_SYSTEM ** | psys, |
int | max, | ||
double | x, | ||
double | y, | ||
double | z, | ||
int | max_sprites | ||
) |
initialize a particle system
psys | a pointer to a NULL initialized PARTICLE_SYSTEM pointer |
max | maximum number of particles in the system. Set to zero or negative to disable the limitation |
x | x position of the emitter |
y | y position of the emitter |
z | z position of the emitter |
max_sprites | maximum number of sprites used in the system. Set to zero or negative if there are no sprites used. |
Definition at line 24 of file n_particles.c.
References __n_assert, LOG_ERR, Malloc, n_log, new_generic_list(), and start_HiTimer().
int manage_particle | ( | PARTICLE_SYSTEM * | psys | ) |
update particles positions usting particle system internal timer
psys | the targeted particle system |
Definition at line 173 of file n_particles.c.
References __n_assert, get_usec(), and manage_particle_ex().
int manage_particle_ex | ( | PARTICLE_SYSTEM * | psys, |
double | delta_t | ||
) |
update particles positions usting provided delta time
psys | the targeted particle system |
delta_t | delta time to use, in msecs |
Definition at line 132 of file n_particles.c.
References __n_assert, Free, remove_list_node, and update_physics_position().
Referenced by manage_particle().
int move_particles | ( | PARTICLE_SYSTEM * | psys, |
double | vx, | ||
double | vy, | ||
double | vz | ||
) |
draw particles of a particle system
psys | the targeted particle system |
vx | x move |
vy | y move |
vz | z move |
Definition at line 304 of file n_particles.c.
References __n_assert.