Gondwana Game Engine Development (master) - 2.7.0
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
ParticleEmitter.cs
1using System.Drawing;
2using SkiaSharp;
3
5
92public sealed class ParticleEmitter
93{
95 public PointF Position { get; set; }
96
98 public float EmitRate { get; set; } = 200f;
99
101 public (float Min, float Max) LifeRange { get; set; } = (0.6f, 1.4f);
102
104 public (float Min, float Max) VelocityRangeX { get; set; } = (-120f, 120f);
105
107 public (float Min, float Max) VelocityRangeY { get; set; } = (-300f, -180f);
108
110 public (float Min, float Max) SizeRange { get; set; } = (3f, 7f);
111
115 public SKColor Color { get; set; } = new SKColor(
116 200,
117 200,
118 255,
119 255);
120
125 public SKBlendMode BlendMode { get; set; } = SKBlendMode.Plus;
126
130 public float JitterX { get; set; } = 0f;
131
135 public float JitterY { get; set; } = 0f;
136
142 public float? GravityX { get; set; } = null;
143
149 public float? GravityY { get; set; } = null;
150
155 public SKBitmap? ParticleSprite { get; set; }
156
161 public SKColor? Tint { get; set; }
162
167 public float? MaxVelocity { get; set; }
168
173
178 public float RingInnerRadius01 { get; set; } = 0.85f;
179
184 public float GaussianStdDev01 { get; set; } = 0.33f;
185
187 public ParticleSpawnHandler? OnSpawn { get; set; }
188
190 public Action<ParticleEmitter, float>? OnUpdate { get; set; }
191
192 // Internal accumulator to handle fractional emit per frame.
193 internal float _accumulator;
194}
Configures how particles are spawned over time at a given location.
SKColor? Tint
Optional per-emitter tint. If set, it overrides the particle system's GlobalColorTint for particles s...
SKColor Color
Base color. Alpha will be modulated by lifetime fade. You can randomize in OnSpawn if desired.
float EmitRate
Particles per second to spawn (fractional allowed).
float JitterX
Gets or sets the horizontal jitter value for spawning particles, which represents a random offset app...
float? GravityY
Gets or sets the vertical component of the gravity vector in pixels per second squared (px/s²)....
float RingInnerRadius01
For Ring distribution: inner radius as a fraction of the outer radius [0..1]. 0 = filled disk,...
ParticleSpawnDistribution SpawnDistribution
Controls the random spawn distribution used by JitterX/JitterY.
SKBlendMode BlendMode
Blend mode used when rendering particles from this emitter. Defaults to SKBlendMode....
SKBitmap? ParticleSprite
Optional sprite used for particles spawned by this emitter. If null, the particle surface’s default s...
PointF Position
RenderHost / adapter pixel position where particles originate.
float? MaxVelocity
Optional per-emitter maximum speed in px/s. If set, particle velocity will be clamped to this magnitu...
ParticleSpawnHandler? OnSpawn
Optional per-particle customization hook (e.g., perlin drift, hue jitter).
float Min
Lifetime range in seconds (min, max).
float GaussianStdDev01
For Gaussian distribution: standard deviation as a fraction of outer radius. Typical values: 0....
float? GravityX
Gets or sets the horizontal component of the gravity vector in pixels per second squared (px/s²)....
Action< ParticleEmitter, float >? OnUpdate
Optional per-frame callback to tweak emitter (e.g., move with an object).
float JitterY
Gets or sets the vertical jitter value for spawning particles, which represents a random offset appli...
delegate void ParticleSpawnHandler(ref Particle particle)
Delegate type for customizing a particle immediately after it is spawned.
ParticleSpawnDistribution
Defines the spatial distribution pattern used when spawning particles within an emitter.