C4 Engine
C4 Engine API Documentation

ParticlePool::NewParticle

Defined in:  C4Particles.h
Returns an unused particle from a particle pool.
Prototype

type *NewParticle(void);

Description
The NewParticle function returns a pointer to an unused particle structure in a particle pool. This function should be called every time a new particle needs to be created in a particle system, and the returned structure should be filled with the initial state of the new particle. The particle can than be added to the particle system associated with the particle pool by calling the ParticleSystem::AddParticle or ParticleSystem::AddFarthestParticle function.

When a particle is no longer needed, it should be freed by calling the ParticleSystem::FreeParticle function. This makes the particle eligible to be returned by the NewParticle function again.

If there are no particles available in the particle pool, then the NewParticle function returns nullptr.
See Also

ParticleSystem::AddParticle

ParticleSystem::AddFarthestParticle

ParticleSystem::FreeParticle