Engine
Raylib based game framework
Loading...
Searching...
No Matches
ParticleSystem Class Reference

Updates and draws particles emitted by entities. More...

#include <ParticleSystem.hpp>

Inheritance diagram for ParticleSystem:
Collaboration diagram for ParticleSystem:

Public Member Functions

 ParticleSystem ()
 Constructs the system and registers component callbacks.
void Update (const float deltaT) override
 Updates all active particles and spawns new ones.
void Draw () const override
 Renders all visible particles.

Static Public Member Functions

static void Burst (const Entity entity, u32 count)
 Instantly spawns a burst of particles.
static void Stop (const Entity entity)
 Stops automatic spawning on the emitter.
static void Play (const Entity entity)
 Resumes automatic spawning on the emitter.

Detailed Description

Updates and draws particles emitted by entities.

Requires entities to have a Component::ParticleEmitter and a std::vector<Component::Particle>. Handles spawning, physics, aging, and texture‑sorted rendering.

Member Function Documentation

◆ Burst()

void ParticleSystem::Burst ( const Entity entity,
u32 count )
static

Instantly spawns a burst of particles.

Parameters
entityEntity holding the ParticleEmitter.
countNumber of particles to spawn.

Does nothing if entity lacks ParticleEmitter or Transform.

◆ Draw()

void ParticleSystem::Draw ( ) const
overridevirtual

Renders all visible particles.

Interpolates color and size based on age/lifetime. Uses DrawTexturePro if a valid texture is provided, otherwise falls back to circles.

Reimplemented from System.

◆ Play()

void ParticleSystem::Play ( const Entity entity)
static

Resumes automatic spawning on the emitter.

Parameters
entityEntity with ParticleEmitter.

◆ Stop()

void ParticleSystem::Stop ( const Entity entity)
static

Stops automatic spawning on the emitter.

Parameters
entityEntity with ParticleEmitter.

◆ Update()

void ParticleSystem::Update ( const float deltaT)
overridevirtual

Updates all active particles and spawns new ones.

Parameters
deltaTTime since last update (seconds).
  • Applies velocity, gravity, angular velocity and aging.
  • Removes expired particles.
  • If emitter is playing, spawns particles at the given rate.
  • Marks sort dirty when particles change.

Implements System.


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