Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
ParticleEmitter Struct Reference

A struct that represents the configurations of a particle emitter. More...

#include <particles.h>

Public Attributes

Vec2 position
 Position of the emitter.
 
float emissionRate
 Time between emissions in seconds.
 
int emissionNumber
 Number of particles to emit per emission.
 
int maxParticles
 Maximum particles this emitter can have.
 
Vec2 direction
 Base direction of emission.
 
float angleRange
 Spread angle in degrees (0 - 360).
 
bool active
 Whether the current emitter is active.
 
float emitterLifetime
 How long the emitter is active in seconds.
 
float emitterAge
 How long the emitter has been active in seconds.
 
int loopCount
 Number of times to loop.
 
bool destroyWhenDone
 Destroys emitter when all particles are gone.
 
bool cameraLocked
 If true, particles will appear static on the screen.
 
float particleLifetime
 How long particles live in seconds.
 
float particleSpeed
 Particle movement speed.
 
void(* custom_Movement )(Particle *)
 Movement behavior function (Will override default movement)
 
SDL_Color startColor
 Initial particle color.
 
SDL_Color endColor
 Final particle color.
 
Vec2 startSize
 Initial size of particles in pixels.
 
Vec2 endSize
 Final size of particles in pixels.
 
SDL_Texture * particleTexture
 Optional texture (NULL = rectangle)
 
Vec2 gravity
 Force applied over time.
 
float drag
 Air resistance factor.
 
Timer * emissionTimer
 Timer for emission control.
 
Particle * particles
 Array of particles.
 
int readyIndex
 Next available particle index.
 
struct ParticleEmitter ** selfReference
 A double pointer to this emitter.
 
bool useCollider
 Whether to use a collider for the emitter.
 
Collider collider
 Collider for the emitter (Not implemented)
 

Detailed Description

A struct that represents the configurations of a particle emitter.

Emitter is responsible for creating and managing particles. Emitter presets (such as fire, smoke, gunshots, etc.) can be created and reused inside particle_emitterpresets.h and .c Emitters themselves can be created with ParticleEmitter_CreateDefault() and then modified as needed.

Warning
Make sure to set the selfReference field to the address of the emitter pointer.
ParticleEmitter *emitter = ParticleEmitter_CreateDefault();
emitter->selfReference = &emitter;
A struct that represents the configurations of a particle emitter.
Definition particles.h:105
struct ParticleEmitter ** selfReference
A double pointer to this emitter.
Definition particles.h:144
Call ParticleEmitter_Update() and ParticleEmitter_Render() every frame to update and render the particles.

Member Data Documentation

◆ active

bool ParticleEmitter::active

Whether the current emitter is active.

◆ angleRange

float ParticleEmitter::angleRange

Spread angle in degrees (0 - 360).

Spread is applied to direction.

◆ cameraLocked

bool ParticleEmitter::cameraLocked

If true, particles will appear static on the screen.

◆ collider

Collider ParticleEmitter::collider

Collider for the emitter (Not implemented)

◆ custom_Movement

void(* ParticleEmitter::custom_Movement) (Particle *)

Movement behavior function (Will override default movement)

◆ destroyWhenDone

bool ParticleEmitter::destroyWhenDone

Destroys emitter when all particles are gone.

Suitable for one-time effects.

◆ direction

Vec2 ParticleEmitter::direction

Base direction of emission.

Direction is randomized by angleRange

◆ drag

float ParticleEmitter::drag

Air resistance factor.

◆ emissionNumber

int ParticleEmitter::emissionNumber

Number of particles to emit per emission.

◆ emissionRate

float ParticleEmitter::emissionRate

Time between emissions in seconds.

◆ emissionTimer

Timer* ParticleEmitter::emissionTimer

Timer for emission control.

◆ emitterAge

float ParticleEmitter::emitterAge

How long the emitter has been active in seconds.

◆ emitterLifetime

float ParticleEmitter::emitterLifetime

How long the emitter is active in seconds.

◆ endColor

SDL_Color ParticleEmitter::endColor

Final particle color.

◆ endSize

Vec2 ParticleEmitter::endSize

Final size of particles in pixels.

◆ gravity

Vec2 ParticleEmitter::gravity

Force applied over time.

◆ loopCount

int ParticleEmitter::loopCount

Number of times to loop.

-1 for Infinite. 1 for once. 0 for none

◆ maxParticles

int ParticleEmitter::maxParticles

Maximum particles this emitter can have.

◆ particleLifetime

float ParticleEmitter::particleLifetime

How long particles live in seconds.

◆ particles

Particle* ParticleEmitter::particles

Array of particles.

◆ particleSpeed

float ParticleEmitter::particleSpeed

Particle movement speed.

◆ particleTexture

SDL_Texture* ParticleEmitter::particleTexture

Optional texture (NULL = rectangle)

◆ position

Vec2 ParticleEmitter::position

Position of the emitter.

◆ readyIndex

int ParticleEmitter::readyIndex

Next available particle index.

◆ selfReference

struct ParticleEmitter** ParticleEmitter::selfReference

A double pointer to this emitter.

Used to set the reference to NULL when destroyed.

◆ startColor

SDL_Color ParticleEmitter::startColor

Initial particle color.

◆ startSize

Vec2 ParticleEmitter::startSize

Initial size of particles in pixels.

◆ useCollider

bool ParticleEmitter::useCollider

Whether to use a collider for the emitter.


The documentation for this struct was generated from the following file: