1
0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-21 18:22:40 +01:00

Removed confirmation for exit done from the menu.

Issue #173.
This commit is contained in:
Muzychenko Andrey 2023-03-10 09:28:28 +03:00
parent 4b86fe2aa7
commit f521a03322
3 changed files with 10 additions and 6 deletions

View File

@ -562,7 +562,7 @@ void pb::InputDown(GameInput input)
const auto bindings = options::MapGameInput(input);
for (const auto binding : bindings)
{
winmain::HandleGameBinding(binding);
winmain::HandleGameBinding(binding, true);
}
if (game_mode != GameModes::InGame || winmain::single_step || demo_mode)

View File

@ -1131,7 +1131,7 @@ void winmain::UpdateFrameRate()
TargetFrameTime = DurationMs(1000.0 / ups);
}
void winmain::HandleGameBinding(GameBindings binding)
void winmain::HandleGameBinding(GameBindings binding, bool shortcut)
{
switch (binding)
{
@ -1158,10 +1158,14 @@ void winmain::HandleGameBinding(GameBindings binding)
options::toggle(Menu1::Show_Menu);
break;
case GameBindings::Exit:
if (!shortcut)
{
ShowExitPopup = true;
break;
SDL_Event event{SDL_QUIT};
SDL_PushEvent(&event);
}
else
ShowExitPopup = true;
break;
default:
break;
}
@ -1236,6 +1240,6 @@ void winmain::ImGuiMenuItemWShortcut(GameBindings binding, bool selected)
const auto& keyDef = Options.Key[~binding];
if (ImGui::MenuItem(pb::get_rc_string(keyDef.Description), keyDef.GetShortcutDescription().c_str(), selected))
{
HandleGameBinding(binding);
HandleGameBinding(binding, false);
}
}

View File

@ -86,7 +86,7 @@ public:
static void pause(bool toggle = true);
static void Restart();
static void UpdateFrameRate();
static void HandleGameBinding(GameBindings binding);
static void HandleGameBinding(GameBindings binding, bool shortcut);
private:
static int return_value;
static int mouse_down, last_mouse_x, last_mouse_y;