List of all members | Public Member Functions
thor::UniversalEmitter Class Reference

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...
 

Detailed Description

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.

Member Function Documentation

void thor::UniversalEmitter::operator() ( EmissionInterface system,
sf::Time  dt 
)

Emits particles into a particle system.

Parameters
systemIndirection to the particle system that stores the particles.
dtTime interval during which particles are emitted.
void thor::UniversalEmitter::setEmissionRate ( float  particlesPerSecond)

Sets the particle emission rate.

Parameters
particlesPerSecondHow 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.

Parameters
particleColorConstant 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.

Parameters
particleLifetimeConstant or function returning the particle lifetime.
void thor::UniversalEmitter::setParticlePosition ( Distribution< sf::Vector2f >  particlePosition)

Sets the initial particle position.

Parameters
particlePositionConstant or function returning the initial particle position.
void thor::UniversalEmitter::setParticleRotation ( Distribution< float >  particleRotation)

Sets the initial particle rotation.

Parameters
particleRotationConstant or function returning the initial particle rotation.
void thor::UniversalEmitter::setParticleRotationSpeed ( Distribution< float >  particleRotationSpeed)

Sets the initial particle rotation speed.

Parameters
particleRotationSpeedConstant or function returning the initial particle rotation speed.
void thor::UniversalEmitter::setParticleScale ( Distribution< sf::Vector2f >  particleScale)

Sets the initial particle scale.

Parameters
particleScaleConstant or function returning the initial particle scale.
void thor::UniversalEmitter::setParticleTextureIndex ( Distribution< unsigned int >  particleTextureIndex)

Sets the initial particle texture index.

Parameters
particleTextureIndexConstant 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.

Parameters
particleVelocityConstant or function returning the initial particle velocity.

The documentation for this class was generated from the following file: