Class that emits particles with customizable initial conditions. More...
Public Member Functions | |
UniversalEmitter () | |
Default constructor. | |
void | operator() (EmissionInterface &system, sf::Time dt) |
Emits particles into a particle system. More... | |
void | setEmissionRate (float particlesPerSecond) |
Sets the particle emission rate. More... | |
void | setParticleLifetime (Distribution< sf::Time > particleLifetime) |
Sets the lifetime (time between emission and death) of the particle. More... | |
void | setParticlePosition (Distribution< sf::Vector2f > particlePosition) |
Sets the initial particle position. More... | |
void | setParticleVelocity (Distribution< sf::Vector2f > particleVelocity) |
Sets the initial particle velocity. More... | |
void | setParticleRotation (Distribution< float > particleRotation) |
Sets the initial particle rotation. More... | |
void | setParticleRotationSpeed (Distribution< float > particleRotationSpeed) |
Sets the initial particle rotation speed. More... | |
void | setParticleScale (Distribution< sf::Vector2f > particleScale) |
Sets the initial particle scale. More... | |
void | setParticleColor (Distribution< sf::Color > particleColor) |
Sets the initial particle color. More... | |
void | setParticleTextureIndex (Distribution< unsigned int > particleTextureIndex) |
Sets the initial particle texture index. More... | |
Class that emits particles with customizable initial conditions.
This emitter is universal with respect to the initial conditions of each emitted particle. It works with callbacks that return initial values for the particle attributes (position, rotation, color, ...). So you can pass constants, random distributions, or any functions that compute the value in an arbitrary way. Have a look at the thor::Distributions namespace for useful predefined functions.
void thor::UniversalEmitter::operator() | ( | EmissionInterface & | system, |
sf::Time | dt | ||
) |
Emits particles into a particle system.
system | Indirection to the particle system that stores the particles. |
dt | Time interval during which particles are emitted. |
void thor::UniversalEmitter::setEmissionRate | ( | float | particlesPerSecond | ) |
Sets the particle emission rate.
particlesPerSecond | How many particles are emitted in 1 second. The type is not integral to allow more flexibility (e.g. 0.5 yields one particle every 2 seconds). |
void thor::UniversalEmitter::setParticleColor | ( | Distribution< sf::Color > | particleColor | ) |
Sets the initial particle color.
particleColor | Constant or function returning the initial particle color. |
void thor::UniversalEmitter::setParticleLifetime | ( | Distribution< sf::Time > | particleLifetime | ) |
Sets the lifetime (time between emission and death) of the particle.
particleLifetime | Constant or function returning the particle lifetime. |
void thor::UniversalEmitter::setParticlePosition | ( | Distribution< sf::Vector2f > | particlePosition | ) |
Sets the initial particle position.
particlePosition | Constant or function returning the initial particle position. |
void thor::UniversalEmitter::setParticleRotation | ( | Distribution< float > | particleRotation | ) |
Sets the initial particle rotation.
particleRotation | Constant or function returning the initial particle rotation. |
void thor::UniversalEmitter::setParticleRotationSpeed | ( | Distribution< float > | particleRotationSpeed | ) |
Sets the initial particle rotation speed.
particleRotationSpeed | Constant or function returning the initial particle rotation speed. |
void thor::UniversalEmitter::setParticleScale | ( | Distribution< sf::Vector2f > | particleScale | ) |
Sets the initial particle scale.
particleScale | Constant or function returning the initial particle scale. |
void thor::UniversalEmitter::setParticleTextureIndex | ( | Distribution< unsigned int > | particleTextureIndex | ) |
Sets the initial particle texture index.
particleTextureIndex | Constant or function returning the initial index of the particle's texture rectangle. |
void thor::UniversalEmitter::setParticleVelocity | ( | Distribution< sf::Vector2f > | particleVelocity | ) |
Sets the initial particle velocity.
particleVelocity | Constant or function returning the initial particle velocity. |