VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Member Functions | List of all members
WaterParticle Class Reference

A Particle which destroys itself after a decay time has elapsed. More...

Inheritance diagram for WaterParticle:
Particle

Public Member Functions

 WaterParticle (ParticleLayer *layer, const QPointF &position, const QPointF &velocity, const QColor &color, float decayTime)
 Constructs a WaterParticle in the given ParticleLayer with the specified position, velocity, color, and time-to-live. More...
 
 WaterParticle (ParticleLayer *layer, int index, float decayTime)
 Constructs a WaterParticle to represent an already existing particle in the particle system. More...
 
void beginDecaying ()
 Start the decay of this WaterParticle. More...
 
void resetDecayTime ()
 Reset the decay time of this WaterParticle. More...
 
void update ()
 Process the decay timer, deleting this WaterParticle if the decay time has elapsed. More...
 
- Public Member Functions inherited from Particle
 Particle (ParticleLayer *layer)
 Constructs a new Particle. More...
 
bool isDestroyed () const
 Returns whether or not destroy() was already called. More...
 
void destroy ()
 Destroys the associated LiquidFun particle, removing it from the b2ParticleSystem. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Particle
void createNewParticle (const QPointF &position, const QPointF &velocity, const QColor &color)
 Constructs a new LiquidFun particle in the particle system associated with this wrapper, using the specified position, velocity, and color. More...
 
void mapToExistingParticle (int index)
 Associates this Particle with an existing LiquidFun particle in the b2ParticleSystem. More...
 

Detailed Description

A Particle which destroys itself after a decay time has elapsed.

Constructor & Destructor Documentation

WaterParticle::WaterParticle ( ParticleLayer layer,
const QPointF position,
const QPointF velocity,
const QColor color,
float  decayTime 
)

Constructs a WaterParticle in the given ParticleLayer with the specified position, velocity, color, and time-to-live.

Parameters
layerParticleLayer to spawn particle in
positionPosition in world coordinates to spawn the particle at
velocityInitial velocity of the particle
colorColor of the particle
decayTimeDecay time of the particle
WaterParticle::WaterParticle ( ParticleLayer layer,
int  index,
float  decayTime 
)

Constructs a WaterParticle to represent an already existing particle in the particle system.

This method uses Particle::mapToExistingParticle() to attach to an existing particle.

Parameters
layerParticleLayer the existing particle is in
indexIndex of the particle to attach to
decayTimeDecay time of the particle

Member Function Documentation

void WaterParticle::beginDecaying ( )

Start the decay of this WaterParticle.

Once the decay time interval of game time has elapsed, the WaterParticle will delete itself in update().

void WaterParticle::resetDecayTime ( )

Reset the decay time of this WaterParticle.

void WaterParticle::update ( )

Process the decay timer, deleting this WaterParticle if the decay time has elapsed.