Added single stepping

This commit is contained in:
Simon Lübeß
2021-07-19 20:06:37 +02:00
parent 9158da60c2
commit b1ad7b5ba3
+30 -5
View File
@@ -67,22 +67,47 @@ 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)
{ {
_gameTime.NewFrame(); if(allowFrame)
{
_gameTime.NewFrame();
}
Input.NewFrame(); Input.NewFrame();
for(Layer layer in _layerStack) #if APP_SINGLESTEP
layer.Update(_gameTime); allowFrame = disableSingleFrame || Input.IsKeyPressing(Key.F10);
if(Input.IsKeyPressing(Key.F11))
{
disableSingleFrame = !disableSingleFrame;
}
#endif
if(allowFrame)
{
for(Layer layer in _layerStack)
layer.Update(_gameTime);
}
_window.Update(); _window.Update();
_imGuiLayer.ImGuiRender(); if(allowFrame)
{
_imGuiLayer.ImGuiRender();
_window.Context.SwapChain.Present(); _window.Context.SwapChain.Present();
}
} }
} }