VoltAir
|
Wrapper around a LiquidFun particle. More...
Public Member Functions | |
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... | |
Protected Member Functions | |
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... | |
Wrapper around a LiquidFun particle.
When createNewParticle() is called, a new LiquidFun particle is spawned, and its user data property is set to this Particle's pointer. This allows the Particle for each LiquidFun particle to be easily retrieved. The LiquidFun particle is destroyed when destroy() is called, or when this object is deleted.
Particle::Particle | ( | ParticleLayer * | layer | ) |
Constructs a new Particle.
layer | ParticleLayer to associate with |
|
protected |
Constructs a new LiquidFun particle in the particle system associated with this wrapper, using the specified position, velocity, and color.
The new particle's user data will be set to point to this object.
position | Position in world coordinates to spawn the new particle at |
velocity | Initial velocity of the new particle |
color | Color to set for the new particle |
void Particle::destroy | ( | ) |
Destroys the associated LiquidFun particle, removing it from the b2ParticleSystem
.
|
inline |
Returns whether or not destroy() was already called.
|
protected |
Associates this Particle with an existing LiquidFun particle in the b2ParticleSystem
.
This does the equivalent of createNewParticle(), without spawning a new particle. Instead it is used to "take over" particles spawned through other means. For example, when spawning groups of particles using b2ParticleSystem::CreateParticleGroup()
, multiple particles get created, and can be attached to Particle wrappers using this method.
index | Index of the LiquidFun particle to attach to |