Allow only a single instance of the exit prompt

This is required because there is a very low-level shortcut that can create one even if one is already being shown.
This commit is contained in:
Tamás Bálint Misius 2024-10-18 08:55:25 +02:00
parent 03e1b12173
commit ca930c2494
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 11 additions and 3 deletions

View File

@ -66,9 +66,15 @@ void Engine::Exit()
void Engine::ConfirmExit()
{
new ConfirmPrompt("You are about to quit", "Are you sure you want to exit the game?", { [] {
ui::Engine::Ref().Exit();
} });
if (!confirmingExit)
{
confirmingExit = true;
new ConfirmPrompt("You are about to quit", "Are you sure you want to exit the game?", { [] {
ui::Engine::Ref().Exit();
}, [this] {
confirmingExit = false;
} });
}
}
void Engine::ShowWindow(Window * window)

View File

@ -79,6 +79,8 @@ namespace ui
Graphics * g;
bool GraveExitsConsole;
bool confirmingExit = false;
unsigned int FrameIndex;
private:
FpsLimit fpsLimit;