Header menu logo Mibo.Raylib

ParticleSimulation Module

Helpers for particle simulation. Called in the user's update function.

These operate on the simulation state (velocity, lifetime, etc.), not the render snapshot. After simulation, map your sim state to Particle2D render snapshots for the view function.

Functions and values

Function or value Description

fadeAndCompact particles count fadeSpeed dt

Full Usage: fadeAndCompact particles count fadeSpeed dt

Parameters:
    particles : Particle2D[] - The particle render snapshot array. Mutated in place.
    count : byref<int> - Current active count. Updated to reflect compacted array.
    fadeSpeed : float32 - Alpha reduction per second. 255.0f means a particle fades completely in 1 second.
    dt : float32 - Delta time in seconds.

Modifiers: inline

Fades particles by reducing alpha and compacts the dead ones out of the array. Particles with alpha <= 0 are removed. Returns the new count via the byref parameter. Call this in your Tick handler after updating positions/velocities.

particles : Particle2D[]

The particle render snapshot array. Mutated in place.

count : byref<int>

Current active count. Updated to reflect compacted array.

fadeSpeed : float32

Alpha reduction per second. 255.0f means a particle fades completely in 1 second.

dt : float32

Delta time in seconds.

Type something to start searching.