Initialize WebGPU

This commit is contained in:
2024-08-18 19:53:31 +02:00
parent f64510fbd2
commit b40af1200a
4 changed files with 208 additions and 95 deletions

View File

@@ -14,9 +14,9 @@ public class TestGame : Game
public override void Initialize()
{
_renderer = new RaylibRenderer();
_renderer = new StandardRenderer();
_audioBackend = new FmodAudioBackend();
_inputHandler = new RaylibInputHandler();
// _inputHandler = new RaylibInputHandler();
_resourceManager.AddResourceSaverAssociation(new SerializedSceneSaver());
@@ -27,7 +27,7 @@ public class TestGame : Game
}, new RendererSettings()
{
UseVSync = true,
Fullscreen = true
Fullscreen = false
});
_audioBackend.Initialize();
@@ -70,33 +70,36 @@ 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 (_scene!.ShouldRun)
while (_renderer.ShouldRun)
{
_scene.Update();
// _scene.Update();
if (_inputHandler!.IsActionPressed("toggle_fullscreen"))
{
_renderer!.Fullscreen = !_renderer.Fullscreen;
_logger.Info($"Fullscreen: {_renderer.Fullscreen}");
}
// if (_inputHandler!.IsActionPressed("toggle_fullscreen"))
// {
// _renderer!.Fullscreen = !_renderer.Fullscreen;
// _logger.Info($"Fullscreen: {_renderer.Fullscreen}");
// }
_scene.BeginDraw();
_scene.EndDraw();
// _scene.BeginDraw();
// _scene.EndDraw();
_renderer.BeginFrame();
// _renderer.ClearBackground(Color.White);
_renderer.EndFrame();
}
}