Add and implement interfaces for systems (ISystem, IUpdatableSystem, etc.), move Color to Utils, rename Handlers/Renderers/Backends to System, move input related classes to an Input subfolder.

This commit is contained in:
2024-10-14 17:29:52 +02:00
parent 5227c390a1
commit f68f8f4b02
34 changed files with 189 additions and 143 deletions

View File

@@ -12,8 +12,8 @@ public class TestGame : Game
{
InitializeDefault();
_audioBackend = new FmodAudioBackend();
_audioBackend.Initialize();
_audioSystem = new FmodAudioSystem();
_audioSystem.Start();
}
protected override void LoadResources()
@@ -39,7 +39,7 @@ public class TestGame : Game
_scene = new Scene(new SceneSettings()
{
Renderer = Renderer,
AudioBackend = _audioBackend!,
AudioBackend = _audioSystem!,
InputHandler = Input,
ResourceManager = ResourceManager
});
@@ -47,7 +47,7 @@ public class TestGame : Game
_uiLayer = new UiLayer();
_worldLayer = new EntityLayer();
_testSoundInstance = _audioBackend!.CreateInstance(_testSound!);
_testSoundInstance = _audioSystem!.CreateInstance(_testSound!);
Input.AddInputMapping("play", new InputAction[] { new KeyInputAction(KeyboardKey.Spacebar) });
Input.AddInputMapping("sprint", new InputAction[] { new KeyInputAction(KeyboardKey.LeftShift) });
@@ -82,13 +82,13 @@ public class TestGame : Game
public override void Shutdown()
{
ShutdownDefault();
_audioBackend!.Dispose();
_audioSystem!.Dispose();
}
private Sound? _testSound;
private SoundInstance? _testSoundInstance;
private Font? _font;
private FmodAudioBackend? _audioBackend;
private FmodAudioSystem? _audioSystem;
private Scene? _scene;
private UiLayer? _uiLayer;