summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index f58b145..5773be2 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -12,6 +12,7 @@
#include "interface/Slider.h"
#include "search/Thumbnail.h"
#include "simulation/SaveRenderer.h"
+#include "dialogues/ConfirmPrompt.h"
#include "Format.h"
#include "QuickOption.h"
@@ -888,6 +889,22 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
}
}
+void GameView::ExitPrompt()
+{
+ class ExitConfirmation: public ConfirmDialogueCallback {
+ public:
+ ExitConfirmation() {}
+ virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) {
+ if (result == ConfirmPrompt::ResultOkay)
+ {
+ ui::Engine::Ref().Exit();
+ }
+ }
+ virtual ~ExitConfirmation() { }
+ };
+ new ConfirmPrompt("You are about to quit", "Are you sure you want to exit the game?", new ExitConfirmation());
+}
+
void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip)
{
this->toolTip = toolTip;
@@ -1024,6 +1041,10 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case 'y':
c->SwitchAir();
break;
+ case KEY_ESCAPE:
+ case 'q':
+ ExitPrompt();
+ break;
case 'u':
c->ToggleAHeat();
break;