From: Ingo Ruhnke Date: Mon, 25 Aug 2014 04:30:20 +0000 (+0200) Subject: Added little toy test for Dialog when exiting SuperTux X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=13b09b4d6bfb6e97526061138624c39aa1fd8a1a;p=supertux.git Added little toy test for Dialog when exiting SuperTux --- diff --git a/src/supertux/menu/main_menu.cpp b/src/supertux/menu/main_menu.cpp index 8eb4d7aa8..615c0aab7 100644 --- a/src/supertux/menu/main_menu.cpp +++ b/src/supertux/menu/main_menu.cpp @@ -17,6 +17,7 @@ #include "supertux/menu/main_menu.hpp" #include "audio/sound_manager.hpp" +#include "gui/dialog.hpp" #include "gui/menu_item.hpp" #include "gui/menu_manager.hpp" #include "supertux/fadeout.hpp" @@ -80,8 +81,15 @@ MainMenu::menu_action(MenuItem* item) break; case MNID_QUITMAINMENU: - ScreenManager::current()->quit(std::unique_ptr(new FadeOut(0.25))); - SoundManager::current()->stop_music(0.25); + std::unique_ptr dialog(new Dialog); + dialog->set_text(_("Do you really want to quit SuperTux?")); + dialog->add_button(_("Cancel")); + dialog->add_button(_("Quit SuperTux"), [] { + MenuManager::instance().clear_menu_stack(); + ScreenManager::current()->quit(std::unique_ptr(new FadeOut(0.25))); + SoundManager::current()->stop_music(0.25); + }, true); + MenuManager::instance().set_dialog(std::move(dialog)); break; } }