Add fullscreen property to Renderer. Still needs to be properly implemented for RaylibRenderer.

This commit is contained in:
2024-01-21 22:31:24 +01:00
parent 8b82e83c60
commit 9ec3dcfcca
4 changed files with 54 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ using DaggerFramework.Rendering;
using DaggerFramework.Audio;
using DaggerFramework.Resources;
using DaggerFramework.SceneGraph;
using DaggerFramework.Utils;
public class TestGame : Game
@@ -26,7 +27,7 @@ public class TestGame : Game
}, new RendererSettings()
{
UseVSync = true,
Fullscreen = false
Fullscreen = true
});
_audioBackend.Initialize();
@@ -71,6 +72,7 @@ public class TestGame : Game
{
_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!);
@@ -78,14 +80,6 @@ public class TestGame : Game
_worldLayer.AddEntity(new TestPlayer());
_scene.AddLayer("UI", _uiLayer!);
SerializedScene serializedScene;
if (_scene!.TrySerialize(out serializedScene))
{
_resourceManager.TrySave(Path.Combine(_resourceManager.ResourceRoot, "main.scene"), in serializedScene);
}
_scene.Start();
}
@@ -94,6 +88,13 @@ public class TestGame : Game
while (_scene!.ShouldRun)
{
_scene.Update();
if (_inputHandler!.IsActionPressed("toggle_fullscreen"))
{
_renderer!.Fullscreen = !_renderer.Fullscreen;
_logger.Info($"Fullscreen: {_renderer.Fullscreen}");
}
_scene.BeginDraw();
_scene.EndDraw();
}
@@ -109,4 +110,5 @@ public class TestGame : Game
private UiLayer? _uiLayer;
private EntityLayer? _worldLayer;
private Logger _logger = new(nameof(TestGame));
}