Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_particles.h
Go to the documentation of this file.
1
9#ifndef __N_PARTICLE_HEADER
10#define __N_PARTICLE_HEADER
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
21#include <allegro5/allegro.h>
22#include <allegro5/allegro_audio.h>
23#include <allegro5/allegro_acodec.h>
24#include <allegro5/allegro_font.h>
25#include <allegro5/allegro_image.h>
26#include <allegro5/allegro_primitives.h>
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
56typedef struct PARTICLE {
58 int mode,
65
67 ALLEGRO_COLOR color;
68
71
72} PARTICLE;
73
75typedef struct PARTICLE_SYSTEM {
78
81
84
86 ALLEGRO_BITMAP** sprites;
90
91int init_particle_system(PARTICLE_SYSTEM** psys, int max, double x, double y, double z, int max_sprites);
92
93int add_particle(PARTICLE_SYSTEM* psys, int spr, int mode, int lifetime, int size, ALLEGRO_COLOR color, PHYSICS object);
94int 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);
95
96int manage_particle_ex(PARTICLE_SYSTEM* psys, double delta_t);
97
99
100int draw_particle(PARTICLE_SYSTEM* psys, double xpos, double ypos, int w, int h, double range);
101
103
104int move_particles(PARTICLE_SYSTEM* psys, double vx, double vy, double vz);
105
110#ifdef __cplusplus
111}
112#endif
113
114#endif /* PARTICLE_HEADER_FOR_CHRISTMASHACK */
int mode
Network for managing conenctions.
Definition ex_network.c:22
Structure of a generic LIST container.
Definition n_list.h:40
Timing Structure.
Definition n_time.h:32
N_TIME timer
Internal: particle system timer.
Definition n_particles.h:83
int size
size of particle
Definition n_particles.h:64
int max_sprites
size of the picture library
Definition n_particles.h:88
ALLEGRO_COLOR color
color of the particle
Definition n_particles.h:67
PHYSICS object
particle physical properties
Definition n_particles.h:70
int spr_id
sprite id in library
Definition n_particles.h:62
int lifetime
lifetime
Definition n_particles.h:60
VECTOR3D source
Coordinate of emitting point.
Definition n_particles.h:80
LIST * list
list of PARTICLE pointers
Definition n_particles.h:77
int mode
particle mode: NORMAL_PART,SINUS_PART,PIXEL_PART
Definition n_particles.h:58
ALLEGRO_BITMAP ** sprites
Library of picture for the particles.
Definition n_particles.h:86
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:98
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:54
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:22
Structure of a single particle.
Definition n_particles.h:56
Structure of a particle system.
Definition n_particles.h:75
double VECTOR3D[3]
struct of a point
Definition n_3d.h:40
structure of the physics of an object
Definition n_3d.h:49
Simple 3D movement simulation.
Common headers and low-level functions & define.
List structures and definitions.
Generic log system.
Timing utilities.