summaryrefslogtreecommitdiff
path: root/src/game/GameController.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-28 13:13:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-28 13:13:28 (GMT)
commitfc93b714852b1bd0741fd75a9dd01358f32fa9f0 (patch)
tree449e9c5add679af58a660a74b056f2827b6eec1f /src/game/GameController.cpp
parentf9eeebb91039d88ceb7e4cf4e4aecf374d77e633 (diff)
downloadpowder-fc93b714852b1bd0741fd75a9dd01358f32fa9f0.zip
powder-fc93b714852b1bd0741fd75a9dd01358f32fa9f0.tar.gz
Resize brush X and Y axis seperately using Shift and Control, Addresses issue #27
Diffstat (limited to 'src/game/GameController.cpp')
-rw-r--r--src/game/GameController.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index db23bb8..aede8d6 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -185,9 +185,13 @@ void GameController::PlaceSave(ui::Point position)
}
}
-void GameController::AdjustBrushSize(int direction, bool logarithmic)
+void GameController::AdjustBrushSize(int direction, bool logarithmic, bool xAxis, bool yAxis)
{
+ if(xAxis && yAxis)
+ return;
+
ui::Point newSize(0, 0);
+ ui::Point oldSize = gameModel->GetBrush()->GetRadius();
if(logarithmic)
newSize = gameModel->GetBrush()->GetRadius() + ui::Point(direction * ((gameModel->GetBrush()->GetRadius().X/10)>0?gameModel->GetBrush()->GetRadius().X/10:1), direction * ((gameModel->GetBrush()->GetRadius().Y/10)>0?gameModel->GetBrush()->GetRadius().Y/10:1));
else
@@ -196,7 +200,14 @@ void GameController::AdjustBrushSize(int direction, bool logarithmic)
newSize.X = 0;
if(newSize.Y<0)
newSize.Y = 0;
- gameModel->GetBrush()->SetRadius(newSize);
+
+ if(xAxis)
+ gameModel->GetBrush()->SetRadius(ui::Point(newSize.X, oldSize.Y));
+ else if(yAxis)
+ gameModel->GetBrush()->SetRadius(ui::Point(oldSize.X, newSize.Y));
+ else
+ gameModel->GetBrush()->SetRadius(newSize);
+
BrushChanged(gameModel->GetBrushID(), gameModel->GetBrush()->GetRadius().X, gameModel->GetBrush()->GetRadius().Y);
}