From 3c9019e37abfe4aa32b05ec4248b4f954844526b Mon Sep 17 00:00:00 2001 From: dnesov Date: Thu, 22 Aug 2024 20:22:01 +0200 Subject: [PATCH] Update TestGame --- TestGame/TestGame.cs | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/TestGame/TestGame.cs b/TestGame/TestGame.cs index ca90f18..caf1412 100644 --- a/TestGame/TestGame.cs +++ b/TestGame/TestGame.cs @@ -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(); } }