GraphicsAPI reference
Class ParticleSystem
Namespace: MicroEngine.Graphics
Assembly: MicroEngine.Graphics2D.dll
Guide: Graphics
A pooled particle system for dust, sparks, confetti, smoke and the like.
public sealed class ParticleSystemInheritance
Constructors
ParticleSystem(int, int)
Creates an empty system.
public ParticleSystem(int capacity = 512, int seed = 3)Parameters
capacity int
Maximum number of live particles; emissions beyond it are dropped.
seed int
Seed of the system’s own random numbers, so effects repeat exactly.
Properties
Additive
When true, particles are drawn with additive blending (glows, sparks).
public bool Additive { get; set; }Property Value
Count
Number of live particles.
public int Count { get; }Property Value
Methods
Clear()
Removes every particle.
public void Clear()Draw(IRenderer, float)
Draws every live particle. With Additive, the blend mode is set to additive and back to Alpha afterwards.
public void Draw(IRenderer renderer, float blend = 1)Parameters
renderer IRenderer
The renderer.
blend float
How far between the last two updates to draw them (the game’s FrameBlend, or 1 for
the last update, the default): with the game’s blend they move evenly on displays of any rate.
Emit(Vector2, ParticleSpec, int, Vector2)
Spawns particles with random values within the ranges of spec.
public void Emit(Vector2 at, ParticleSpec spec, int count = 1, Vector2 inheritVelocity = default)Parameters
at Vector2
Spawn point in the coordinates the system is drawn in.
spec ParticleSpec
How the particles look and move; kept by reference, so do not change it while its particles live.
count int
Number of particles; those beyond the capacity are dropped.
inheritVelocity Vector2
Velocity added to each particle, in pixels per second (for example the emitter’s).
Update(float)
Ages and moves every particle by dt seconds and removes those past their life.
public void Update(float dt)Parameters
dt float