mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add engine pause mode
This commit is contained in:
parent
c152cfc03f
commit
95f30da49b
4 changed files with 114 additions and 77 deletions
|
|
@ -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());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue