Update TestGame

This commit is contained in:
2024-08-22 20:22:01 +02:00
parent a005caf54a
commit 3c9019e37a

View File

@@ -14,9 +14,9 @@ public class TestGame : Game
public override void Initialize()
{
_renderer = new StandardRenderer();
_renderer = new RaylibRenderer();
_audioBackend = new FmodAudioBackend();
// _inputHandler = new RaylibInputHandler();
_inputHandler = new RaylibInputHandler();
_resourceManager.AddResourceSaverAssociation(new SerializedSceneSaver());
@@ -70,37 +70,26 @@ public class TestGame : Game
protected override void Ready()
{
// _inputHandler!.AddInputMapping("play", new InputAction[] { new KeyInputAction(KeyboardKey.Spacebar) });
// _inputHandler.AddInputMapping("sprint", new InputAction[] { new KeyInputAction(KeyboardKey.LeftShift) });
// _inputHandler.AddInputMapping("toggle_fullscreen", new InputAction[] { new KeyInputAction(KeyboardKey.F11) });
_inputHandler!.AddInputMapping("play", new InputAction[] { new KeyInputAction(KeyboardKey.Spacebar) });
_inputHandler.AddInputMapping("sprint", new InputAction[] { new KeyInputAction(KeyboardKey.LeftShift) });
_inputHandler.AddInputMapping("toggle_fullscreen", new InputAction[] { new KeyInputAction(KeyboardKey.F11) });
// _scene!.AddLayer("World", _worldLayer!);
_scene!.AddLayer("World", _worldLayer!);
// _worldLayer!.AddEntity(new World());
// _worldLayer.AddEntity(new TestPlayer());
_worldLayer!.AddEntity(new World());
_worldLayer.AddEntity(new TestPlayer());
// _scene.AddLayer("UI", _uiLayer!);
// _scene.Start();
_scene.AddLayer("UI", _uiLayer!);
_scene.Start();
}
protected override void Run()
{
while (_renderer.ShouldRun)
while (_scene.ShouldRun)
{
// _scene.Update();
// if (_inputHandler!.IsActionPressed("toggle_fullscreen"))
// {
// _renderer!.Fullscreen = !_renderer.Fullscreen;
// _logger.Info($"Fullscreen: {_renderer.Fullscreen}");
// }
// _scene.BeginDraw();
// _scene.EndDraw();
_renderer.BeginFrame();
// _renderer.ClearBackground(Color.Aqua);
// // _renderer.DrawRectangle(new Vector2(128, 128), Color.Black);
_renderer.EndFrame();
_scene.Update();
_scene.BeginDraw();
_scene.EndDraw();
}
}