class EE::Graphics::ParticleSystem¶
Overview¶
Basic but powerfull Particle System. More…
#include <particlesystem.hpp> class ParticleSystem { public: // typedefs typedef std::function<void(Particle*, ParticleSystem*)> ParticleCallback; // construction virtual ~ParticleSystem(); // methods void create( const ParticleEffect& Effect, const Uint32& NumParticles, const Uint32& TexId, const Vector2f& Pos, const Float& PartSize = 16.0f, const bool& AnimLoop = false, const Uint32& NumLoops = 1, const ColorAf& color = ColorAf(1.0f, 1.0f, 1.0f, 1.0f), const Vector2f& Pos2 = Vector2f(0, 0), const Float& alphaDecay = 0.01f, const Vector2f& speed = Vector2f(0.1f, 0.1f), const Vector2f& Acc = Vector2f(0.1f, 0.1f) ); void draw(); void update(const Time& time); void update(); void end(); void reuse(); void kill(); void time(const Float& time); Float time() const; void setUsing(const bool& inuse); bool isUsing() const; void setPosition(const Float& x, const Float& y); void setPosition(const Vector2f& Pos); const Vector2f& getPosition() const; void setPosition2(const Float& x, const Float& y); void setPosition2(const Vector2f& Pos); const Vector2f& getPosition2() const; void setCallbackReset(const ParticleCallback& pc); const BlendMode& getBlendMode() const; void setBlendMode(const BlendMode& mode); const ColorAf& getColor() const; void setColor(const ColorAf& Col); const Float& getAlphaDecay() const; void setAlphaDecay(const Float& Decay); const Vector2f& getSpeed() const; void setSpeed(const Vector2f& speed); const Vector2f& getAcceleration() const; void setAcceleration(const Vector2f& acc); };
Detailed Documentation¶
Basic but powerfull Particle System.
Methods¶
void create( const ParticleEffect& Effect, const Uint32& NumParticles, const Uint32& TexId, const Vector2f& Pos, const Float& PartSize = 16.0f, const bool& AnimLoop = false, const Uint32& NumLoops = 1, const ColorAf& color = ColorAf(1.0f, 1.0f, 1.0f, 1.0f), const Vector2f& Pos2 = Vector2f(0, 0), const Float& alphaDecay = 0.01f, const Vector2f& speed = Vector2f(0.1f, 0.1f), const Vector2f& Acc = Vector2f(0.1f, 0.1f) )
Creates the new effect
Parameters:
Effect |
Number of the effect. |
NumParticles |
Number of particles |
TexId |
Texture Id to render the particles |
Pos |
Initial position |
PartSize |
Size of the particles |
AnimLoop |
Loop the animation? |
NumLoops |
If AnimLoop is false, set the number of times to render the effect |
color |
Particles Color (used for NoFx) |
Pos2 |
Extended position for some effects to define the expansion over the screen (used by fire,smoke,snow) |
alphaDecay |
The Alpha Decay for the particles (used for NoFx) |
speed |
The speed on x axis (used for NoFx) |
Acc |
The acceleration of the particle (used for NoFx) |
void draw()
Draw the particles effect
void update(const Time& time)
Update the particles effect
Parameters:
time |
The time transcurred between the last update. |
void update()
Update the particles effect taking the elapsed time from Engine
void end()
Stop using the effect but wait to end the animation
void reuse()
Start using the effect and reset it
void kill()
Stop immediately the effect
void time(const Float& time)
Change the default time modifier. Default 0.01f
Float time() const
Get the time modifier
void setUsing(const bool& inuse)
Set if the effect it’s in use
bool isUsing() const
Returns:
It’s used or no
void setPosition(const Float& x, const Float& y)
Update the effect position
void setPosition(const Vector2f& Pos)
Update the effect position
const Vector2f& getPosition() const
Returns:
The effect position
void setPosition2(const Float& x, const Float& y)
Update the effect position 2
void setPosition2(const Vector2f& Pos)
Update the effect position 2
const Vector2f& getPosition2() const
Returns:
The effect position 2
void setCallbackReset(const ParticleCallback& pc)
Set a callback function for the reset effect of the particles.
The reset it’s where do you create the effect for every single particle.
const BlendMode& getBlendMode() const
Returns:
The effect blend mode
void setBlendMode(const BlendMode& mode)
Set the effect blend mode
const ColorAf& getColor() const
Returns:
The color of the effect
void setColor(const ColorAf& Col)
Set the color of the effect
const Float& getAlphaDecay() const
Returns:
The alpha decay of the effect
void setAlphaDecay(const Float& Decay)
Set the alpha decay of the effect
const Vector2f& getSpeed() const
Returns:
The Speed of the effect
void setSpeed(const Vector2f& speed)
Set the Speed of the effect
const Vector2f& getAcceleration() const
Returns:
The Acceleration of the effect
void setAcceleration(const Vector2f& acc)
Set The Acceleration of the effect