Added single stepping

This commit is contained in:
Simon Lübeß
2021-07-19 20:06:37 +02:00
parent 9158da60c2
commit b1ad7b5ba3
+25
View File
@@ -67,24 +67,49 @@ namespace GlitchyEngine
} }
} }
#if APP_SINGLESTEP
bool allowFrame = false;
bool disableSingleFrame = false;
#else
const bool allowFrame = true;
#endif
public void Run() public void Run()
{ {
while(_running) while(_running)
{
if(allowFrame)
{ {
_gameTime.NewFrame(); _gameTime.NewFrame();
}
Input.NewFrame(); Input.NewFrame();
#if APP_SINGLESTEP
allowFrame = disableSingleFrame || Input.IsKeyPressing(Key.F10);
if(Input.IsKeyPressing(Key.F11))
{
disableSingleFrame = !disableSingleFrame;
}
#endif
if(allowFrame)
{
for(Layer layer in _layerStack) for(Layer layer in _layerStack)
layer.Update(_gameTime); layer.Update(_gameTime);
}
_window.Update(); _window.Update();
if(allowFrame)
{
_imGuiLayer.ImGuiRender(); _imGuiLayer.ImGuiRender();
_window.Context.SwapChain.Present(); _window.Context.SwapChain.Present();
} }
} }
}
public void PushLayer(Layer ownLayer) => _layerStack.PushLayer(ownLayer); public void PushLayer(Layer ownLayer) => _layerStack.PushLayer(ownLayer);