Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZE::ZSimpleParticleSystem< particleType > Class Template Reference

#include <ZE_ZSimpleParticleSystem.h>

Inherits ZE::ZBaseParticleSystem< particleType >< particleType >.

List of all members.


Detailed Description

template<class particleType>
class ZE::ZSimpleParticleSystem< particleType >

ZSimpleParticleSystem class, example of implementation of a particle system on top of ZBaseParticleSystem base, designed for flexibility and ease of use over speed. More specific, therefore even less optimized for specific circumstances. Should be concidered usable but not optimal. (Although it is a great source of code for your own implementations.)


Public Member Functions

virtual void Render ()
 Draws all particles.

void ReloadImage ()
 Reload image.

void SetDrawStyle (ParticleDrawStyle style)
 Sets ParticleDrawStyle for this system.

void SetImage (std::string filename)
 Sets image for particle system. filename Filename of image to load for the system.

void SetPosRange (float minX, float minY, float maxX, float maxY)
 Sets the range of initial positions.

void SetVelocityRange (float minXVel, float minYVel, float maxXVel, float maxYVel)
 Sets range of velocities for particles.

void SetEnergyRange (float minEnergy, float maxEnergy, float minEnergyDelta=0, float maxEnergyDelta=0)
 Sets range of initial energy and energyDelta.

void SetSizeRange (float minSize, float maxSize, float minSizeDelta=0, float maxSizeDelta=0)
 Sets range of initial size and sizeDelta.

void SetColorRange (Uint8 minRed, Uint8 maxRed, Uint8 minGreen, Uint8 maxGreen, Uint8 minBlue, Uint8 maxBlue, Uint8 minAlpha, Uint8 maxAlpha)
 Set range of color for a new particle.


Protected Member Functions

virtual particleType NewParticle ()
 Function which creates a new particle.

virtual void UpdateParticle (int index, float elapsedTime)
 Updates a given particle given it's index and the elapsedTime.


Protected Attributes

ParticleDrawStyle rStyle
 Draw style, one of the three enumerated values specifying how particles will be drawn.

ZImage rImage
 Image to draw (only used if rStyle is DS_IMAGE).

float rMinX
 Minimum X value for starting position.

float rMaxX
 Maximum X value for starting position.

float rMinY
 Minimum Y value for starting position.

float rMaxY
 Maximum Y value for starting position.

float rMinXVel
 Minimum X velocity, particle moves it's velocity every second.

float rMaxXVel
 Maximum X velocity, particle moves it's velocity every second.

float rMinYVel
 Minimum Y velocity, particle moves it's velocity every second.

float rMaxYVel
 Maximum Y velocity, particle moves it's velocity every second.

float rMinEnergy
 Minimum starting energy. (Remember particles with energy values <= 0 are removed.).

float rMaxEnergy
 Maximum starting energy.

float rMinEnergyDelta
 Minimum energy change per second.

float rMaxEnergyDelta
 Maximum energy change per second.

float rMinSize
 Minimum starting size.

float rMaxSize
 Maximum starting size.

float rMinSizeDelta
 Minimum size change per second.

float rMaxSizeDelta
 Maximum size change per second.

Uint8 rMinRed
 Minimum red component of color, 0-255.

Uint8 rMaxRed
 Maximum red component of color, 0-255.

Uint8 rMinGreen
 Minimum green component of color, 0-255.

Uint8 rMaxGreen
 Maximum green component of color, 0-255.

Uint8 rMinBlue
 Minimum blue component of color, 0-255.

Uint8 rMaxBlue
 Maximum blue component of color, 0-255.

Uint8 rMinAlpha
 Minimum alpha of particle, 0-255.

Uint8 rMaxAlpha
 Maximum alpha of particle, 0-255.


Member Function Documentation

template<class particleType>
particleType ZE::ZSimpleParticleSystem< particleType >::NewParticle  )  [protected, virtual]
 

Implementation of pure virtual NewParticle from ZBaseParticleSystem, creates a new particle with it's members set to values between their min and max value as set by the system.

Implements ZE::ZBaseParticleSystem< particleType >.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::UpdateParticle int  index,
float  elapsedTime
[protected, virtual]
 

Implementation of pure virtual UpdateParticle from ZBaseParticleSystem, updates a given particle relative to the elapsed time.

Parameters:
index Index of particle in rParticles array to update.
elapsedTime Decimal portion of a second since last call.

Implements ZE::ZBaseParticleSystem< particleType >.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::Render  )  [virtual]
 

Implementation of pure virtual Render from ZBaseParticleSystem, draws all particles in specified ParticleDrawStyle.

Implements ZE::ZBaseParticleSystem< particleType >.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::ReloadImage  ) 
 

Reload image if mode is DS_IMAGE, usage is same as ZImage::Reload.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetDrawStyle ParticleDrawStyle  style  ) 
 

Sets the method of drawing particles, point, line, or image particles.

Parameters:
style ParticleDrawStyle for this particle system to use.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetImage std::string  filename  ) 
 

Sets image for particle system to use, assuming the drawing style is DS_IMAGE.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetPosRange float  minX,
float  minY,
float  maxX,
float  maxY
 

Sets the range of initial positions for a new particle.

Parameters:
minX Minimum X coordinate for new particles.
minY Minimum Y coordinate for new particles.
maxX Maximum X coordinate for new particles.
maxY Maximum Y coordinate for new particles.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetVelocityRange float  minXVel,
float  minYVel,
float  maxXVel,
float  maxYVel
 

Sets range from which a new particle obtains it's random velocity,

Parameters:
minXVel Minimum X velocity of a particle.
minYVel Minimum Y velocity of a particle.
maxXVel Maximum X velocity of a particle.
maxYVel Maximum Y velocity of a particle.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetEnergyRange float  minEnergy,
float  maxEnergy,
float  minEnergyDelta = 0,
float  maxEnergyDelta = 0
 

Sets the possible ranges for a particles starting energy and it's energyDelta. Particles with energy less than or equal to 0 are deleted by ZBaseParticleSystem::Update.

Parameters:
minEnergy Minimum initial energy.
maxEnergy Maximum initial energy.
minEnergyDelta Minimum energy delta.
maxEnergyDelta Maximum energy delta.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetSizeRange float  minSize,
float  maxSize,
float  minSizeDelta = 0,
float  maxSizeDelta = 0
 

Sets the possible ranges for a particles starting size and it's sizeDelta.

Parameters:
minSize Minimum initial size.
maxSize Maximum initial size.
minSizeDelta Minimum size delta.
maxSizeDelta Maximum size delta.

template<class particleType>
void ZE::ZSimpleParticleSystem< particleType >::SetColorRange Uint8  minRed,
Uint8  maxRed,
Uint8  minGreen,
Uint8  maxGreen,
Uint8  minBlue,
Uint8  maxBlue,
Uint8  minAlpha,
Uint8  maxAlpha
 

Sets range of possible colors, by component, for a new particle.

Parameters:
minRed Minimum value of red component (0-255).
maxRed Minimum value of red component (0-255).
minGreen Minimum value of green component (0-255).
maxGreen Minimum value of green component (0-255).
minBlue Minimum value of blue component (0-255).
maxBlue Minimum value of blue component (0-255).
minAlpha Minimum value of alpha value (0-255).
maxAlpha Minimum value of alpha value (0-255).


The documentation for this class was generated from the following file:
Generated on Sun Oct 5 19:34:46 2003 for ZEngine by doxygen1.3