The LARC Game Engine
A Simple Game Engine from the Laboratory for Recreational Computing
Public Member Functions | Private Attributes | List of all members
LParticleEngine2D Class Reference

The 2D particle engine. More...

#include <ParticleEngine.h>

Inheritance diagram for LParticleEngine2D:
LParticleEngine< LParticle2D, LParticleDesc2D, Vector2 > LComponent

Public Member Functions

 LParticleEngine2D (LSpriteRenderer *)
 Constructor. More...
 
void Draw ()
 Draw particles. More...
 
- Public Member Functions inherited from LParticleEngine< LParticle2D, LParticleDesc2D, Vector2 >
 LParticleEngine ()
 Constructor.
 
virtual ~LParticleEngine ()
 Destructor. More...
 
void create (const LParticleDesc2D &d)
 Create particle. More...
 
void step ()
 Animation step. More...
 
void clear (float=0.1f)
 Fade out all particles. More...
 
void clear (UINT)
 Clear out a particular kind of particle. More...
 
void translate (const Vector2 &)
 Translate. More...
 

Private Attributes

LSpriteRendererm_pRenderer = nullptr
 Pointer to a 2D renderer.
 

Additional Inherited Members

- Protected Member Functions inherited from LParticleEngine< LParticle2D, LParticleDesc2D, Vector2 >
void move ()
 Move all particles. More...
 
float GetLifeFraction (const LParticle2D *)
 Get life fraction. More...
 
void cull ()
 Cull old dead particles. More...
 
void rescale ()
 Compute new particle scales. More...
 
void fade ()
 Compute new particle alpha channel. More...
 
- Protected Attributes inherited from LParticleEngine< LParticle2D, LParticleDesc2D, Vector2 >
std::list< LParticle2D * > m_stdList
 Particle list.
 
- Static Protected Attributes inherited from LComponent
static LTimerm_pTimer = &cTimer
 Pointer to a timer. More...
 
static LRandomm_pRandom = &cRandom
 Pointer to a PRNG. More...
 
static LKeyboardm_pKeyboard = &cKeyboard
 Pointer to a keyboard handler. More...
 
static LXBoxControllerm_pController = &cController
 Pointer to a XBox controller. More...
 
static LSoundm_pAudio = &cAudio
 Pointer to an audio player. More...
 

Detailed Description

The 2D particle engine needs a pointer to a 2D renderer and will use this to draw particles.

Constructor & Destructor Documentation

◆ LParticleEngine2D()

LParticleEngine2D::LParticleEngine2D ( LSpriteRenderer p)

Save a pointer to the 2D renderer so that particles can be drawn on command.

Parameters
pPointer to the 2D renderer.

Member Function Documentation

◆ Draw()

void LParticleEngine2D::Draw ( )

Draw all particles using the 2D renderer supplied in the constructor.