Update TestGame, add emitter removing, update TODO

This commit is contained in:
2024-10-17 02:20:47 +02:00
parent df2c446501
commit c21e275b6d
3 changed files with 17 additions and 5 deletions

View File

@@ -20,7 +20,7 @@
## Serialization ## Serialization
- Serialize attribute. - Serialize attribute.
- Add automatic serialization of resources through code generation and System.Text.Json. - Add automatic serialization of resources through source generation and System.Text.Json.
- ~~Provide means for fetching key/value configuration (INI? TOML?)~~ - ~~Provide means for fetching key/value configuration (INI? TOML?)~~
- Expose some sort of ConfigFile class for safe key/value configuration fetching. - Expose some sort of ConfigFile class for safe key/value configuration fetching.
@@ -34,17 +34,17 @@
## Audio ## Audio
- ~~Integrate FMOD~~ - ~~Integrate FMOD~~
- 2D audio abstraction - Use SoLoud as a default sound engine.
## Misc ## Misc
- ~~Asset manager~~ - ~~Asset manager~~
- ~~Separate engine and game into separate projects~~ - ~~Separate engine and game into separate projects~~
- Particle system 2.0 - ~~Particle system 2.0~~
- ~~Reduce the size of Particle struct by infering most parameters through lifetime.~~ - ~~Reduce the size of Particle struct by infering most parameters through lifetime.~~
- ~~Reduce cache misses by utilizing SoA.~~ - ~~Reduce cache misses by utilizing SoA.~~
- ~~SIMD acceleration.~~ - ~~SIMD acceleration.~~
- Dynamically resize particle arrays as emitters get added or removed. - ~~Creating and removing emitters.~~
## SceneGraph module ## SceneGraph module
@@ -55,6 +55,7 @@
## Input ## Input
- ~~Action system~~ - ~~Action system~~
- Nicer input mapping API using code.
- Make action system use an InputMap resource instead. - Make action system use an InputMap resource instead.
- Gamepad support - Gamepad support

View File

@@ -70,7 +70,7 @@ public class TestGame : BaseGame
} }
Renderer.ResetTransform(); Renderer.ResetTransform();
Renderer.DrawText(_font, $"Particle Sim: {TimeSpan.FromTicks(_particleSimStopwatch.ElapsedTicks).TotalMilliseconds} ms", Color.White); Renderer.DrawText(_font, $"Particle Sim: {_particleSimStopwatch.Elapsed.TotalMilliseconds} ms", Color.White);
Renderer.SetTransform(new Vector2(0.0f, 16.0f), Vector2.Zero); Renderer.SetTransform(new Vector2(0.0f, 16.0f), Vector2.Zero);
Renderer.DrawText(_font, $"Render: {RenderFrameTime.TotalMilliseconds:F1} ms", Color.White); Renderer.DrawText(_font, $"Render: {RenderFrameTime.TotalMilliseconds:F1} ms", Color.White);

View File

@@ -258,6 +258,17 @@ public class ParticleSystem : IUpdatableSystem, IDisposable
return _emitters.Count - 1; return _emitters.Count - 1;
} }
public void RemoveEmitter(int emitterIdx)
{
if (emitterIdx >= _emitters.Count)
{
throw new ArgumentException($"Emitter with idx {emitterIdx} is not present!");
}
// var emitter = _emitters[emitterIdx];
_emitters.RemoveAt(emitterIdx);
}
public void SetEmitterPosition(int emitterIdx, Vector2 position) public void SetEmitterPosition(int emitterIdx, Vector2 position)
{ {
if (emitterIdx >= _emitters.Count) if (emitterIdx >= _emitters.Count)