add engine pause mode

This commit is contained in:
MihailRis
2025-10-07 18:02:06 +03:00
parent c152cfc03f
commit 95f30da49b
4 changed files with 114 additions and 77 deletions
+24
View File
@@ -309,6 +309,30 @@ void Engine::nextFrame() {
input->pollEvents();
}
void Engine::startPauseLoop() {
bool initialCursorLocked = false;
if (!isHeadless()) {
initialCursorLocked = input->isCursorLocked();
if (initialCursorLocked) {
input->toggleCursor();
}
}
while (!isQuitSignal()) {
if (!debuggingServer->update()) {
debuggingServer.reset();
break;
}
if (isHeadless()) {
platform::sleep(1.0 / params.tps * 1000);
} else {
nextFrame();
}
}
if (initialCursorLocked) {
input->toggleCursor();
}
}
void Engine::renderFrame() {
screen->draw(time.getDelta());