#include <ZE_ZBaseParticleSystem.h>
Inherited by ZE::ZSimpleParticleSystem< particleType >.
Public Member Functions | |
ZBaseParticleSystem () | |
Basic constructor for ZBaseParticleSystem. | |
virtual | ~ZBaseParticleSystem () |
Virtual destructor for ZBaseParticleSystem. | |
virtual void | Render ()=0 |
Pure virtual function, renders the particles. | |
void | Emit (int numParticles) |
Emit a given number of particles. | |
virtual void | Update () |
Updates status of particle system. | |
void | Clear () |
Empties particle system of all particles. | |
void | Pause () |
Pauses particle system. | |
void | Unpause () |
Unpauses particle system. | |
void | Stop () |
Clears system and pauses it. | |
bool | Paused () |
Detect if particle system is currently paused. | |
void | SetMaxParticles (unsigned int max) |
Sets max particles allowed in system. | |
void | SetRate (unsigned int rate) |
Sets release rate of particles. | |
Protected Member Functions | |
void | AddParticle () |
Adds a new particle. | |
virtual particleType | NewParticle ()=0 |
Pure virtual function to initialize and return a new particle. | |
virtual void | UpdateParticle (int index, float elapsedTime)=0 |
Pure virtual function to update a particle. | |
Protected Attributes | |
ZEngine * | rEngine |
Pointer to ZEngine singleton. | |
particleType * | rParticles |
Pointer to array of particles. | |
unsigned int | rMaxParticles |
Maximum number of particles, and size of rParticles array. | |
unsigned int | rCurParticles |
Current number of particles. | |
unsigned int | rNumParticlesPerSec |
Number of particles to release per second. | |
Uint32 | rLastUpdate |
Millisecond format time of last update. | |
bool | rPaused |
Boolean value indicating if system is paused. |
|
Basic constructor for ZBaseParticle system, initializes all values to 0. |
|
Virtual destructor for ZBaseParticleSystem, destroys all particles, virtual to make class inheritance-safe. |
|
Finds room in array with dead particle, and adds new particle using NewParticle, called by Emit. |
|
Pure virtual function, overload should set up a new particle with desired traits, called by AddParticle. Implemented in ZE::ZSimpleParticleSystem< particleType >. |
|
Pure virtual function, overload should update the particle `rParticles[index]`, called by Update.
Implemented in ZE::ZSimpleParticleSystem< particleType >. |
|
Pure virtual so that each particle system can render it's member particles in it's own way. Implemented in ZE::ZSimpleParticleSystem< particleType >. |
|
Emits a given number of particles, will not emit particles if system is full.
|
|
Updates entire particle system, calling update on every particle, emitting necessary new particles, removing particles which have an energy <= 0 or are off the screen. Virtual for special cases, but generally should not be overridden. |
|
Empties particle system of all particles, does not alter paused state. |
|
Pauses particle system, particles may still be drawn but particles are not updated. |
|
Returns particle system to active state, system starts unpaused. |
|
Same as calling Clear() and then Pause(), use unpause to restart system. |
|
Returns bool indicating if the particle system is currently paused.
|
|
Set maximum number of particles allowed in system, particles are not emitted when system is full. When this resizes the array contents are moved to the new array, if it shrinks the array particles may be lost.
|
|
Set number of particles to release per second.
|