jubilant-funicular
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nta::ParticleBatch2D Class Reference

Represents a batch of particles of the same "type". More...

#include <ParticleBatch2D.h>

Collaboration diagram for nta::ParticleBatch2D:
Collaboration graph
[legend]

Public Member Functions

 ParticleBatch2D ()
 basic constructor
 
 ~ParticleBatch2D ()
 deletes particles
 
void init (float il, float dr, float r, int mp, int tex, std::function< void(Particle2D &, float)> updateFunc)
 initializes particle batch by specifying properties
 
void addParticle (Particle2D p)
 adds a particle to the batch
 
void draw (SpriteBatch &batch) const
 draws all the particles
 
void update (float dt)
 updates the particles
 
void clear ()
 removes all particles
 

Private Member Functions

int getFreeParticle () const
 returns index of particle with the minimum life
 

Private Attributes

std::function< void(Particle2D &, float)> m_updateFunction
 the function used to update the particles
 
Particle2Dm_particles = nullptr
 the particles themselves
 
float m_initialLife
 the life every particle starts out with
 
float m_decayRate
 the rate with which particles lose life
 
float m_radius
 the radius of an individual particle
 
int m_maxParticles
 maximum number of particles allowed
 
int m_textureID
 texture used by the particles
 

Detailed Description

Represents a batch of particles of the same "type".

Definition at line 21 of file ParticleBatch2D.h.


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