nCine::Particle class

Renders a single particle.

Lightweight Sprite owned and recycled by a ParticleSystem. Carries the simulation state used by particle affectors (remaining and initial life, initial rotation, velocity) and overrides updating and transformation so the particle can move independently of its parent, optionally in local space.

Base classes

class Sprite
Scene node that draws a single textured quad.

Constructors, destructors, conversion operators

Particle(SceneNode* parent, Texture* texture)
Constructor for a particle with a parent and texture, positioned in the relative origin.
Particle(Particle&&) defaulted
Particle(const Particle& other) protected
Protected copy constructor used to clone objects.

Public functions

auto operator=(const Particle&) -> Particle& deleted
auto operator=(Particle&&) -> Particle& defaulted
auto isAlive() const -> bool
Returns true if the particle is still alive.

Public variables

float life_
Current particle remaining life in seconds.
float startingLife
Initial particle remaining life.
float startingRotation
Initial particle rotation.
Vector2f velocity_
Current particle velocity vector.
bool inLocalSpace_
Whether particle transformations are in local space.

Protected functions

auto clone() const -> Particle
Returns a copy of this object.

Private functions

void OnUpdate(float timeMult) override
Called every frame to update the node state.
void transform() override

Function documentation

Particle nCine::Particle::clone() const protected

Returns a copy of this object.