Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
rune::ParticleEmitter Class Reference

Class responsible for creating particle emitters and managing the creation of particles. More...

#include <particleEmitter.h>

Inheritance diagram for rune::ParticleEmitter:
Collaboration diagram for rune::ParticleEmitter:

Public Member Functions

 ParticleEmitter (rune::Vec2 startPos, rune::Vec2 initVel, rune::Color color, int dissolutionRate=5, rune::Vec2 gravity=rune::Vec2(0, 0))
 Overloaded draw function to render particles to the screen. More...
 
void setDissolutionRate (double rate)
 The amount of time in seconds that a particle will exist before it gets destroyed. More...
 
void setGravity (rune::Vec2 gravity)
 Sets the gravity that a particle will be subjected to. More...
 
void fuel (int particles)
 Spawn particles from the particles emitter. More...
 
void update (double dT)
 Update the position of the particles based on velocity and gravity. More...
 
void setCanvasSize (rune::Vec2)
 
void setPosition (rune::Vec2)
 
- Public Member Functions inherited from rune::Component
 Component ()=default
 Default constructor to set up.
 
virtual void awake ()
 A function that will be called before all other start functions but after the component has been assigned to a GameObject.
 
virtual void start ()
 A function for each component that is called once at the beginning of the components lifetime.
 
virtual void update ()
 A function for each component that is called every frame.
 
virtual void fixedUpdate ()
 A function for each component that is called once every physics update.
 
void setParent (GameObject *newParent)
 A function to set the pointer to the parent rune::GameObject for each component. More...
 
void setEnable (bool newEnable)
 Enable or disable the component. More...
 
bool isComponentEnabled (void)
 Gets whether or not the current component is enabled.
 
void onNotify (Signal const &signal) override
 A virtual method to be overridden by a concrete implementation of the observer class.
 

Additional Inherited Members

- Protected Attributes inherited from rune::Component
GameObjectparentObject = nullptr
 The rune::GameObject that this component is attached to. If not attached to a rune::GameObject this will equal nullptr.
 
bool isEnabled = true
 Whether or not the component is currently enabled. If not enabled, update function will not be called.
 

Detailed Description

Class responsible for creating particle emitters and managing the creation of particles.

Author
Thomas Montano
Date
March 2 2020

Constructor & Destructor Documentation

◆ ParticleEmitter()

rune::ParticleEmitter::ParticleEmitter ( rune::Vec2  startPos,
rune::Vec2  initVel,
rune::Color  color,
int  dissolutionRate = 5,
rune::Vec2  gravity = rune::Vec2(0,0) 
)

Overloaded draw function to render particles to the screen.

Default constructor for a particle emitter that establishes position, color, and velocity constraints.

Parameters
startPosThe location in world coordinates of where the particle emitter should spawn particles.
initVelThe initial velocity that particles should be subjected to.
colorThe base color of the particles.
dissolutionRateThe time in seconds that a particle should exist before it gets deleted.
gravityThe gravity vector each particle will be subjected to.

Member Function Documentation

◆ fuel()

void rune::ParticleEmitter::fuel ( int  particles)

Spawn particles from the particles emitter.

Parameters
particlesThe number of particles that should be generated.

◆ setCanvasSize()

void rune::ParticleEmitter::setCanvasSize ( rune::Vec2  canvas)
Parameters
canvasA vector describing the area that a particle will be allowed to exist in.

◆ setDissolutionRate()

void rune::ParticleEmitter::setDissolutionRate ( double  rate)

The amount of time in seconds that a particle will exist before it gets destroyed.

param window Overloaded draw function for rendering the particles to the screen.

Parameters
rateThe amount of time in seconds that a particle should exist before being deleted.

◆ setGravity()

void rune::ParticleEmitter::setGravity ( rune::Vec2  gravity)

Sets the gravity that a particle will be subjected to.

Parameters
gravityThe gravity vector that each particle will be subjected to.

◆ setPosition()

void rune::ParticleEmitter::setPosition ( rune::Vec2  newPos)
Parameters
newPosThe new position that the particle emitter should start generating particle from.

◆ update()

void rune::ParticleEmitter::update ( double  dT)

Update the position of the particles based on velocity and gravity.

Parameters
dTThe amount of time that has passed since the last update call, used to update position of particles.

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