Faster brush adjusting with [ and ], use alt to change to 1 pixel

This commit is contained in:
Simon Robertshaw 2012-07-30 11:25:32 +01:00
parent 9c67d41ad6
commit 6d5388b221
3 changed files with 24 additions and 3 deletions

View File

@ -193,7 +193,7 @@ void GameController::AdjustBrushSize(int direction, bool logarithmic, bool xAxis
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));
newSize = gameModel->GetBrush()->GetRadius() + ui::Point(direction * ((gameModel->GetBrush()->GetRadius().X/5)>0?gameModel->GetBrush()->GetRadius().X/5:1), direction * ((gameModel->GetBrush()->GetRadius().Y/5)>0?gameModel->GetBrush()->GetRadius().Y/5:1));
else
newSize = gameModel->GetBrush()->GetRadius() + ui::Point(direction, direction);
if(newSize.X<0)

View File

@ -909,6 +909,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
{
case KEY_ALT:
drawSnap = true;
enableAltBehaviour();
break;
case KEY_CTRL:
if(drawModeReset)
@ -989,10 +990,10 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
c->OpenStamps();
break;
case ']':
c->AdjustBrushSize(1, true, shiftBehaviour, ctrlBehaviour);
c->AdjustBrushSize(1, !alt, shiftBehaviour, ctrlBehaviour);
break;
case '[':
c->AdjustBrushSize(-1, true, shiftBehaviour, ctrlBehaviour);
c->AdjustBrushSize(-1, !alt, shiftBehaviour, ctrlBehaviour);
break;
}
@ -1019,6 +1020,7 @@ void GameView::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bo
{
case KEY_ALT:
drawSnap = false;
disableAltBehaviour();
break;
case KEY_CTRL:
disableCtrlBehaviour();
@ -1264,6 +1266,22 @@ void GameView::disableShiftBehaviour()
}
}
void GameView::enableAltBehaviour()
{
if(!altBehaviour)
{
altBehaviour = true;
}
}
void GameView::disableAltBehaviour()
{
if(altBehaviour)
{
altBehaviour = false;
}
}
void GameView::enableCtrlBehaviour()
{
if(!ctrlBehaviour)

View File

@ -40,6 +40,7 @@ private:
bool drawSnap;
bool shiftBehaviour;
bool ctrlBehaviour;
bool altBehaviour;
bool showHud;
int toolIndex;
@ -109,6 +110,8 @@ private:
void disableShiftBehaviour();
void enableCtrlBehaviour();
void disableCtrlBehaviour();
void enableAltBehaviour();
void disableAltBehaviour();
public:
GameView();