summaryrefslogtreecommitdiff
path: root/src/game/GameController.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-02 16:01:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-02 16:01:28 (GMT)
commitefddc12e5d2aadc5eee1927245ad38b9dee89aed (patch)
treecf7ad38119f0734609944158e33bbb944925c777 /src/game/GameController.cpp
parent289556ac7078963b6af361f5812dd62e6712359f (diff)
downloadpowder-efddc12e5d2aadc5eee1927245ad38b9dee89aed.zip
powder-efddc12e5d2aadc5eee1927245ad38b9dee89aed.tar.gz
Stamps browser, placement + clipboard sampling and placement - No clipboard or stamp thumbnail generation, needs thumbnail generator from SaveLoader
Diffstat (limited to 'src/game/GameController.cpp')
-rw-r--r--src/game/GameController.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 7b08716..3408ec5 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -86,6 +86,20 @@ public:
}
};
+class GameController::StampsCallback: public ControllerCallback
+{
+ GameController * cc;
+public:
+ StampsCallback(GameController * cc_) { cc = cc_; }
+ virtual void ControllerExit()
+ {
+ if(cc->stamps->GetStamp())
+ {
+ cc->gameModel->SetStamp(cc->stamps->GetStamp());
+ }
+ }
+};
+
GameController::GameController():
search(NULL),
renderOptions(NULL),
@@ -140,6 +154,24 @@ GameView * GameController::GetView()
return gameView;
}
+void GameController::PlaceStamp(ui::Point position)
+{
+ if(gameModel->GetStamp())
+ {
+ gameModel->GetSimulation()->Load(position.X, position.Y, gameModel->GetStamp()->data, gameModel->GetStamp()->dataLength);
+ gameModel->SetPaused(gameModel->GetPaused());
+ }
+}
+
+void GameController::PlaceClipboard(ui::Point position)
+{
+ if(gameModel->GetClipboard())
+ {
+ gameModel->GetSimulation()->Load(position.X, position.Y, gameModel->GetClipboard()->data, gameModel->GetClipboard()->dataLength);
+ gameModel->SetPaused(gameModel->GetPaused());
+ }
+}
+
void GameController::AdjustBrushSize(int direction)
{
ui::Point newSize = gameModel->GetBrush()->GetRadius() + ui::Point(direction, direction);
@@ -395,6 +427,12 @@ void GameController::OpenTags()
}
}
+void GameController::OpenStamps()
+{
+ stamps = new StampsController(new StampsCallback(this));
+ ui::Engine::Ref().ShowWindow(stamps->GetView());
+}
+
void GameController::OpenDisplayOptions()
{
//TODO: Implement