Implements the particle system for visual effects. More...
#include <particles.h>#include <app.h>#include <time_system.h>#include <timer.h>#include <random.h>Functions | |
| ParticleEmitter * | ParticleEmitter_CreateFromPreset (ParticleEmitter preset) |
| [Start] Creates a particle emitter from a preset | |
| void | ParticleEmitter_Update (ParticleEmitter *emitter) |
| [PostUpdate] Controls the particle emitter's particle emission, age, and rendering | |
| void | ParticleEmitter_Render (ParticleEmitter *emitter) |
| [Render] Renders every particle of a particle emitter | |
| void | ParticleEmitter_Emit (ParticleEmitter *emitter) |
| [Utility] Emits a single particle and set its properties based on the emitter | |
| void | ParticleEmitter_UpdateParticles (ParticleEmitter *emitter) |
| [Utility] Update the state, movement, color and size of every particles of a particle emitter | |
| void | ParticleEmitter_SetMaxParticles (ParticleEmitter *emitter, int maxParticles) |
| [Utility] Set the max particles property of an emitter | |
| int | ParticleEmitter_GetNextReady (ParticleEmitter *emitter) |
| [Utility] Gets the index of the next available particle inside an emitter's particle array | |
| void | ParticleEmitter_DestroyEmitter (ParticleEmitter *emitter) |
| [Utility/Quit] Destroys a particle emitter | |
| bool | ParticleEmitter_ParticlesAlive (ParticleEmitter *emitter) |
| [Utility] Check if there are any alive particles inside an emitter's particle array | |
| void | ParticleEmitter_ActivateOnce (ParticleEmitter *emitter) |
| [Utility] Allows a particle emitter to go through another loop | |
| void | ParticleEmitter_Deactivate (ParticleEmitter *emitter) |
| [Utility] Deactivates a particle emitter | |
Implements the particle system for visual effects.
This file contains the implementation of a particle emitter system that can be used to create various visual effects like explosions, muzzle flashes, smoke, etc.
| void ParticleEmitter_ActivateOnce | ( | ParticleEmitter * | emitter | ) |
[Utility] Allows a particle emitter to go through another loop
Activates the emitter once.
Reactivates a particle emitter that was inactive, setting up its state for another emission cycle.
| emitter | A pointer to the particle emitter |
| ParticleEmitter * ParticleEmitter_CreateFromPreset | ( | ParticleEmitter | preset | ) |
[Start] Creates a particle emitter from a preset
Creates a new particle emitter from a preset.
Initializes a new particle emitter based on a preset configuration, allocating memory for the emitter and its particles.
| preset | The preset to create the emitter from. This is found inside particle_emitterpresets.h |
| void ParticleEmitter_Deactivate | ( | ParticleEmitter * | emitter | ) |
[Utility] Deactivates a particle emitter
Deactivates the emitter.
Stops a particle emitter from emitting new particles, though existing particles will continue to update and render.
| emitter | A pointer to the particle emitter |
| void ParticleEmitter_DestroyEmitter | ( | ParticleEmitter * | emitter | ) |
[Utility/Quit] Destroys a particle emitter
Destroys the emitter and frees its memory.
Frees all resources associated with a particle emitter, including particle array and timer.
| emitter | A pointer to the particle emitter |
| void ParticleEmitter_Emit | ( | ParticleEmitter * | emitter | ) |
[Utility] Emits a single particle and set its properties based on the emitter
Emits particles from the emitter.
Creates a new particle with initial properties derived from the emitter settings plus appropriate randomization.
| emitter | A pointer to the particle emitter |
| int ParticleEmitter_GetNextReady | ( | ParticleEmitter * | emitter | ) |
[Utility] Gets the index of the next available particle inside an emitter's particle array
Gets the next available particle index.
Particle is available of it's dead, basically. Searches through the particle array to find the first particle that is not alive.
| emitter | A pointer to the particle emitter |
| bool ParticleEmitter_ParticlesAlive | ( | ParticleEmitter * | emitter | ) |
[Utility] Check if there are any alive particles inside an emitter's particle array
Checks if the emitter has any particles alive.
Scans through all particles in the emitter to determine if any are still active.
| emitter | A pointer to the particle emitter |
| void ParticleEmitter_Render | ( | ParticleEmitter * | emitter | ) |
[Render] Renders every particle of a particle emitter
Renders the particles of an emitter.
Draws all active particles with their current color, size, and position.
| emitter | A pointer to the particle emitter |
| void ParticleEmitter_SetMaxParticles | ( | ParticleEmitter * | emitter, |
| int | maxParticles | ||
| ) |
[Utility] Set the max particles property of an emitter
Sets the maximum number of particles for an emitter.
This is probably never going to be used, since this is already set inside particle_emitterpreset. Only use this if (for some reason) you want to change a particle emitter's max particles in the middle of a game
| emitter | A pointer to the particle emitter |
| maxParticles | The target max particle number |
| void ParticleEmitter_Update | ( | ParticleEmitter * | emitter | ) |
[PostUpdate] Controls the particle emitter's particle emission, age, and rendering
Updates the emitter.
Updates all aspects of a particle emitter including emission of new particles, updating existing particles, and handling emitter lifecycle events.
| emitter | A pointer to the particle emitter |
| void ParticleEmitter_UpdateParticles | ( | ParticleEmitter * | emitter | ) |
[Utility] Update the state, movement, color and size of every particles of a particle emitter
Updates the particles of an emitter.
Processes all active particles, updating their position, color, size, and rotation based on their current state and lifecycle.
| emitter | A pointer to the particle emitter |