mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-22 20:59:21 +01:00
Show quit game prompt when attempting to close window (#13)
This commit is contained in:
parent
0aafcb6ee2
commit
1ec20de2f5
@ -166,6 +166,8 @@ namespace recomp {
|
|||||||
// TODO move these
|
// TODO move these
|
||||||
void quicksave_save();
|
void quicksave_save();
|
||||||
void quicksave_load();
|
void quicksave_load();
|
||||||
|
|
||||||
|
void open_quit_game_prompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -128,9 +128,19 @@ bool sdl_event_filter(void* userdata, SDL_Event* event) {
|
|||||||
InputState.controller_states.erase(controller_event->which);
|
InputState.controller_states.erase(controller_event->which);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_EventType::SDL_QUIT:
|
case SDL_EventType::SDL_QUIT: {
|
||||||
|
if (!ultramodern::is_game_started()) {
|
||||||
ultramodern::quit();
|
ultramodern::quit();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (recomp::get_current_menu() != recomp::Menu::Config) {
|
||||||
|
recomp::set_current_menu(recomp::Menu::Config);
|
||||||
|
}
|
||||||
|
|
||||||
|
recomp::open_quit_game_prompt();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SDL_EventType::SDL_MOUSEWHEEL:
|
case SDL_EventType::SDL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
SDL_MouseWheelEvent* wheel_event = &event->wheel;
|
SDL_MouseWheelEvent* wheel_event = &event->wheel;
|
||||||
|
@ -246,7 +246,7 @@ void close_config_menu() {
|
|||||||
close_config_menu_impl();
|
close_config_menu_impl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_quit_game_prompt() {
|
void recomp::open_quit_game_prompt() {
|
||||||
prompt_context.open_prompt(
|
prompt_context.open_prompt(
|
||||||
"Are you sure you want to quit?",
|
"Are you sure you want to quit?",
|
||||||
"Any progress since your last save will be lost.",
|
"Any progress since your last save will be lost.",
|
||||||
@ -466,7 +466,7 @@ public:
|
|||||||
|
|
||||||
recomp::register_event(listener, "open_quit_game_prompt",
|
recomp::register_event(listener, "open_quit_game_prompt",
|
||||||
[](const std::string& param, Rml::Event& event) {
|
[](const std::string& param, Rml::Event& event) {
|
||||||
open_quit_game_prompt();
|
recomp::open_quit_game_prompt();
|
||||||
});
|
});
|
||||||
|
|
||||||
recomp::register_event(listener, "toggle_input_device",
|
recomp::register_event(listener, "toggle_input_device",
|
||||||
|
Loading…
Reference in New Issue
Block a user