L_ParticleEffect Class Reference

#include <L_ParticleEffect.h>

Inheritance diagram for L_ParticleEffect:

L_DroppingEffect L_ExplosionEffect L_ShootingEffect List of all members.

Detailed Description

Particle effect interface.

Public Member Functions

 L_ParticleEffect (int period_t, int x, int y)
 L_ParticleEffect (const L_ParticleEffect &cpy)
virtual ~L_ParticleEffect ()
int add (L_Particle *fl_p, L_REAL prob=-1)
void set_velocity (const L_Vector &v_t)
void set_velocity (L_REAL x_length, L_REAL y_length)
void set_position (L_REAL x, L_REAL y)
void set_rotation_distortion (L_REAL rotation_dis)
void set_size_distortion (L_REAL size_dis)
void set_life_distortion (int life_dis)
void set_life (int effect_life)
void set_follow_shooting (bool flag=true)
void set_addit_vector (const L_Vector &v_t)
void set_period (int millisecond)
L_REAL get_x_pos (void)
L_REAL get_y_pos (void)
int get_particle_num (void)
int get_life (void)
int get_period (void)
void trigger (void)
void initialize (void)
void run (int time_elapesed_t)
void draw (int x_shift=0, int y_shift=0)
virtual L_ParticleEffectnew_clone (void)=0
virtual void activate_particle (int time_elapesed_t)

Public Attributes

std::list< L_Particle * > particle_list
L_REAL x_pos
L_REAL y_pos

Constructor & Destructor Documentation

L_ParticleEffect int  period_t,
int  x,
int  y

period : time(milisec) interval between two emissions, 1 <= period < infinity
v_t : velocity for this effect

L_ParticleEffect const L_ParticleEffect cpy  ) 

Copy contructor.
Note : this does not copy particle list.

virtual ~L_ParticleEffect  )  [virtual]


Member Function Documentation

int add L_Particle fl_p,
L_REAL  prob = -1

Add a particle type for the effect and probability for the particle to be chosen for every emission.
Note : If no probabily is specified, the particle will get the remaining probability to 1 ( if more than 1 probability non-specified particle, remaining probability to 1 will be equally divided for each. Maximum number of particle types is limited to 8.

void set_velocity const L_Vector v_t  ) 

Copy effect's velocity from "v_t".

void set_velocity L_REAL  x_length,
L_REAL  y_length

Set effect's velocity(vector) using X length and Y length.
Note : Use this function rather than set_position() if possible, internally there is calculation to have better motion even in jecky framerate environment. If you require to control exact position with no any accumulated error, call additional set_position() after run().

void set_position L_REAL  x,

Set position.

void set_rotation_distortion L_REAL  rotation_dis  ) 

Apply distortion for particles' initial rotation (in radian).
rotation_dis : 0 - 2 PI, 0 to disable the distortion

void set_size_distortion L_REAL  size_dis  ) 

Apply distortion for particles' size.
size_dis : 0 to disable the distortion

void set_life_distortion int  life_dis  ) 

Apply distortion for particles' life.
life_dis : 0 to disable the distortion

void set_life int  effect_life  ) 

Set the effect's life, L_INFINITE_LIFE for infinite life.

void set_follow_shooting bool  flag = true  ) 

Set the particles facing to the direction of its initial velocity.
Note : Rotation distortion will be disabled, if you need the particles always to face its velocity direction even after the velocity has been changed, please use L_Particle::rotating4().

void set_addit_vector const L_Vector v_t  ) 

Add additional vector for emitted particle, can be used for interia effect

void set_period int  millisecond  ) 

Set period for emission in milli second.

void trigger void   ) 

Trigger particle emission.

void initialize void   ) 

Initialization, must be called (once) before calling run(int).

virtual L_ParticleEffect* new_clone void   )  [pure virtual]

Create a clone this particle effect.

Implemented in L_DroppingEffect, L_ExplosionEffect, and L_ShootingEffect.

virtual void activate_particle int  time_elapesed_t  )  [virtual]

Run all particles in the list( by calling run(int) function of particles ) with certain time.
Basically this is used to resolve the inaccuracy of particle emission and movement when the frame rate is low, normal users should not use this function unless there is intention to write custom ParticleEffect.

logo LinearParticle Documentation © 2006-2007 by Wong Chin Foo.
Generated on 8 Jun 2007 by doxygen 1.4.6-NO