SAGE
A Simple Academic Game Engine
Loading...
Searching...
No Matches
Sage::CParticleEngine2D Class Reference

The 2D particle engine. More...

#include <SageParticleEngine.h>

Inheritance diagram for Sage::CParticleEngine2D:
Collaboration diagram for Sage::CParticleEngine2D:

Public Member Functions

 CParticleEngine2D (CSpriteRenderer *)
 Constructor.
 
void Draw ()
 Draw particles.
 
- Public Member Functions inherited from Sage::CParticleEngine< CParticle2D, CParticleDesc2D, Vector2 >
 CParticleEngine ()
 Constructor.
 
virtual ~CParticleEngine ()
 Destructor.
 
void Create (const CParticleDesc2D &d)
 Create particle.
 
void Step ()
 Animation step.
 
void Clear (float=0.1f)
 Fade out all particles.
 
void Clear (UINT)
 Clear out a particular kind of particle.
 
void Translate (const Vector2 &)
 Translate all particles.
 
void TranslateTo (const Vector2 &)
 Translate all particles to a point.
 
void SetOrigin (const Vector2 &)
 Set origin.
 

Private Attributes

CSpriteRendererm_pRenderer = nullptr
 Pointer to a 2D renderer.
 

Additional Inherited Members

- Protected Member Functions inherited from Sage::CParticleEngine< CParticle2D, CParticleDesc2D, Vector2 >
void Move ()
 Move all particles.
 
const float GetLifeFraction (const CParticle2D *) const
 Get life fraction.
 
void Cull ()
 Cull old dead particles.
 
void Rescale ()
 Compute new particle scales.
 
void Fade ()
 Compute new particle alpha channel.
 
- Protected Attributes inherited from Sage::CParticleEngine< CParticle2D, CParticleDesc2D, Vector2 >
std::list< CParticle2D * > m_stdList
 Particle list.
 
Vector2 m_vOrigin
 Origin in world space.
 
- Static Protected Attributes inherited from Sage::CComponent
static std::unique_ptr< CTimerm_pTimer = std::make_unique<CTimer>()
 Pointer to a timer.
 
static std::unique_ptr< CRandomm_pRandom = std::make_unique<CRandom>()
 Pointer to a PRNG.
 
static std::unique_ptr< CSoundm_pSound = std::make_unique<CSound>()
 Pointer to sound manager.
 
static std::unique_ptr< CKeyboardm_pKeyboard
 Pointer to a keyboard handler.
 
static std::unique_ptr< CMousem_pMouse = std::make_unique<CMouse>()
 Pointer to a mouse handler.
 
static std::unique_ptr< CControllerm_pController
 Pointer to a controller.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ CParticleEngine2D()

CParticleEngine2D::CParticleEngine2D ( CSpriteRenderer * 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 CParticleEngine2D::Draw ( )

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

Here is the call graph for this function: