summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-10 14:41:39 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-10 14:41:39 (GMT)
commitcd051924d9ca6d5c39e02111bc311fda9126435e (patch)
tree43624435bfcab57e69fb12068f24cd2a0518dfaa /src/game
parent643128ac5f6f159acf9eb31104dde19f4511d2b9 (diff)
downloadpowder-cd051924d9ca6d5c39e02111bc311fda9126435e.zip
powder-cd051924d9ca6d5c39e02111bc311fda9126435e.tar.gz
Installation with Ctrl+I, fixes #77
Diffstat (limited to 'src/game')
-rw-r--r--src/game/GameController.cpp31
-rw-r--r--src/game/GameController.h2
-rw-r--r--src/game/GameView.cpp4
3 files changed, 37 insertions, 0 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 622752b..9636c8f 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -10,6 +10,7 @@
#include "login/LoginController.h"
#include "interface/Point.h"
#include "dialogues/ErrorMessage.h"
+#include "dialogues/InformationMessage.h"
#include "dialogues/ConfirmPrompt.h"
#include "GameModelException.h"
#include "simulation/Air.h"
@@ -172,6 +173,36 @@ void GameController::PlaceSave(ui::Point position)
}
}
+void GameController::Install()
+{
+#if defined(MACOSX)
+ new InformationMessage("No Installation necessary", "You don't need to install The Powder Toy on Mac OS X");
+#elif defined(WIN) || defined(LIN)
+ class InstallConfirmation: public ConfirmDialogueCallback {
+ public:
+ GameController * c;
+ InstallConfirmation(GameController * c_) { c = c_; }
+ virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) {
+ if (result == ConfirmPrompt::ResultOkay)
+ {
+ if(Client::Ref().DoInstallation())
+ {
+ new InformationMessage("Install Success", "The installation completed without error");
+ }
+ else
+ {
+ new ErrorMessage("Could not install", "The installation did not complete due to an error");
+ }
+ }
+ }
+ virtual ~InstallConfirmation() { }
+ };
+ new ConfirmPrompt("Install The Powder Toy", "You are about to install The Powder Toy onto this computer", new InstallConfirmation(this));
+#else
+ new ErrorMessage("Cannot install", "You cannot install The Powder Toy on this platform");
+#endif
+}
+
void GameController::AdjustBrushSize(int direction, bool logarithmic, bool xAxis, bool yAxis)
{
if(xAxis && yAxis)
diff --git a/src/game/GameController.h b/src/game/GameController.h
index 187d101..b301032 100644
--- a/src/game/GameController.h
+++ b/src/game/GameController.h
@@ -63,6 +63,8 @@ public:
void Tick();
void Exit();
+ void Install();
+
void LoadRenderPreset(RenderPreset preset);
void SetZoomEnabled(bool zoomEnable);
void SetZoomPosition(ui::Point position);
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index 885b1e5..85d0e8d 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -1267,6 +1267,10 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case '[':
c->AdjustBrushSize(-1, !alt, shiftBehaviour, ctrlBehaviour);
break;
+ case 'i':
+ if(ctrl)
+ c->Install();
+ break;
}
if(key >= '0' && key <= '9')