diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-22 23:24:49 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-01-22 23:24:49 (GMT) |
| commit | 8c0678fa48f9598a5ade2d4960c46bfea7e6abef (patch) | |
| tree | 880535e7984c24948d345932f680ef806baa4cec /src/game/GameController.cpp | |
| parent | 19c1fa5dcb4c4a2ba9d692e136b17da316a2631b (diff) | |
| download | powder-8c0678fa48f9598a5ade2d4960c46bfea7e6abef.zip powder-8c0678fa48f9598a5ade2d4960c46bfea7e6abef.tar.gz | |
Begining menu, tool
Diffstat (limited to 'src/game/GameController.cpp')
| -rw-r--r-- | src/game/GameController.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index b9c534c..5749fd4 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -50,8 +50,19 @@ void GameController::AdjustBrushSize(int direction) void GameController::DrawPoints(queue<ui::Point*> & pointQueue) { Simulation * sim = gameModel->GetSimulation(); - int activeElement = gameModel->GetActiveElement(); + Tool * activeTool = gameModel->GetActiveTool(); Brush * cBrush = gameModel->GetBrush(); + if(!activeTool || !cBrush) + { + if(!pointQueue.empty()) + { + while(!pointQueue.empty()) + { + delete pointQueue.front(); + pointQueue.pop(); + } + } + } if(!pointQueue.empty()) { ui::Point * sPoint = NULL; @@ -61,12 +72,12 @@ void GameController::DrawPoints(queue<ui::Point*> & pointQueue) pointQueue.pop(); if(sPoint) { - sim->create_line(fPoint->X, fPoint->Y, sPoint->X, sPoint->Y, 1, 1, activeElement, 0, cBrush); + activeTool->DrawLine(sim, cBrush, *fPoint, *sPoint); delete sPoint; } else { - sim->create_parts(fPoint->X, fPoint->Y, 1, 1, activeElement, 0, cBrush); + activeTool->Draw(sim, cBrush, *fPoint); } sPoint = fPoint; } @@ -85,6 +96,11 @@ void GameController::SetPaused(bool pauseState) gameModel->SetPaused(pauseState); } +void GameController::SetActiveMenu(Menu * menu) +{ + gameModel->SetActiveMenu(menu); +} + void GameController::OpenSearch() { search = new SearchController(); |
