Added single stepping

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