![]() |
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 | |
| #define | CIRCLE_PART 6 |
| circle particle | |
| #define | FIRE_PART 4 |
| fire particle | |
| #define | NORMAL_PART 0 |
| classic moving particle | |
| #define | PIXEL_PART 7 |
| pixel particle | |
| #define | SINUS_PART 1 |
| sinus based moving particle | |
| #define | SNOW_PART 3 |
| snow particle | |
| #define | STAR_PART 5 |
| star particle | |
| #define | TEXT_PART 9 |
| bitmap particle | |
| #define | TRANS_PART 2 |
| transparent particle | |
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 | |
| 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) | |
| int | draw_particle (PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range) |
| draw particles of a particle system | |
| int | free_particle_system (PARTICLE_SYSTEM **psys) |
| destroy and free a particle system | |
| int | init_particle_system (PARTICLE_SYSTEM **psys, int max, double x, double y, double z, int max_sprites) |
| initialize a particle system | |
| int | manage_particle (PARTICLE_SYSTEM *psys) |
| update particles positions usting particle system internal timer | |
| int | manage_particle_ex (PARTICLE_SYSTEM *psys, double delta_t) |
| update particles positions usting provided delta time | |
| int | move_particles (PARTICLE_SYSTEM *psys, double vx, double vy, double vz) |
| draw particles of a particle system | |
| struct PARTICLE |
Structure of a single particle.
Definition at line 56 of file n_particles.h.
Collaboration diagram for PARTICLE:| 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 75 of file n_particles.h.
Collaboration diagram for PARTICLE_SYSTEM:| 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 54 of file n_particles.c.
References __n_assert, PARTICLE::color, PARTICLE::lifetime, PARTICLE_SYSTEM::list, list_push(), Malloc, mode, PARTICLE::mode, LIST::nb_items, LIST::nb_max_items, PARTICLE::object, PARTICLE::size, PARTICLE_SYSTEM::source, and PARTICLE::spr_id.
Referenced by add_particle_ex(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| 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 98 of file n_particles.c.
References add_particle(), mode, and VECTOR3D_SET.
Here is the call graph for this function:| 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 166 of file n_particles.c.
References __n_assert, PARTICLE::color, PARTICLE_SYSTEM::list, PARTICLE_SYSTEM::max_sprites, PARTICLE::mode, LIST_NODE::next, NORMAL_PART, PARTICLE::object, PHYSICS::orientation, PIXEL_PART, PHYSICS::position, LIST_NODE::ptr, SINUS_PART, PARTICLE::size, PHYSICS::speed, PARTICLE::spr_id, PARTICLE_SYSTEM::sprites, and LIST::start.
Referenced by main().
Here is the caller graph for this function:| 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 237 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. Value from UNLIMITED_LIST_ITEMS (0) to MAX_LIST_ITEMS (SIZE_MAX). |
Definition at line 22 of file n_particles.c.
References __n_assert, LOG_ERR, Malloc, n_log, new_generic_list(), and start_HiTimer().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int manage_particle | ( | PARTICLE_SYSTEM * | psys | ) |
update particles positions usting particle system internal timer
| psys | the targeted particle system |
Definition at line 149 of file n_particles.c.
References __n_assert, get_usec(), manage_particle_ex(), and PARTICLE_SYSTEM::timer.
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| 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 116 of file n_particles.c.
References __n_assert, Free, PARTICLE::lifetime, PARTICLE_SYSTEM::list, LIST_NODE::next, PARTICLE::object, LIST_NODE::ptr, remove_list_node, LIST::start, and update_physics_position().
Referenced by manage_particle().
Here is the call graph for this function:
Here is the caller graph for this function:| 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 258 of file n_particles.c.
References __n_assert, PARTICLE_SYSTEM::list, LIST_NODE::next, PARTICLE::object, PHYSICS::position, LIST_NODE::ptr, and LIST::start.