Tool - Correct box drawing. Finishing touches to tool strength (Fixes #87)

This commit is contained in:
Simon Robertshaw 2012-08-10 14:12:56 +01:00
parent 810ea42f99
commit a45ca0363e
2 changed files with 37 additions and 25 deletions

View File

@ -1142,6 +1142,8 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
enableAltBehaviour(); enableAltBehaviour();
break; break;
case KEY_CTRL: case KEY_CTRL:
if(!isMouseDown)
{
if(drawModeReset) if(drawModeReset)
drawModeReset = false; drawModeReset = false;
else else
@ -1150,9 +1152,12 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
drawMode = DrawFill; drawMode = DrawFill;
else else
drawMode = DrawRect; drawMode = DrawRect;
}
enableCtrlBehaviour(); enableCtrlBehaviour();
break; break;
case KEY_SHIFT: case KEY_SHIFT:
if(!isMouseDown)
{
if(drawModeReset) if(drawModeReset)
drawModeReset = false; drawModeReset = false;
else else
@ -1161,6 +1166,7 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
drawMode = DrawFill; drawMode = DrawFill;
else else
drawMode = DrawLine; drawMode = DrawLine;
}
enableShiftBehaviour(); enableShiftBehaviour();
break; break;
case ' ': //Space case ' ': //Space
@ -1538,12 +1544,15 @@ void GameView::enableShiftBehaviour()
if(!shiftBehaviour) if(!shiftBehaviour)
{ {
shiftBehaviour = true; shiftBehaviour = true;
if(isMouseDown)
{
if(!ctrlBehaviour) if(!ctrlBehaviour)
c->SetToolStrength(10.0f); c->SetToolStrength(10.0f);
else else
c->SetToolStrength(1.0f); c->SetToolStrength(1.0f);
} }
} }
}
void GameView::disableShiftBehaviour() void GameView::disableShiftBehaviour()
{ {
@ -1584,12 +1593,15 @@ void GameView::enableCtrlBehaviour()
saveSimulationButton->Appearance.TextInactive = ui::Colour(0, 0, 0); saveSimulationButton->Appearance.TextInactive = ui::Colour(0, 0, 0);
searchButton->Appearance.BackgroundInactive = ui::Colour(255, 255, 255); searchButton->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
searchButton->Appearance.TextInactive = ui::Colour(0, 0, 0); searchButton->Appearance.TextInactive = ui::Colour(0, 0, 0);
if(isMouseDown)
{
if(!shiftBehaviour) if(!shiftBehaviour)
c->SetToolStrength(.1f); c->SetToolStrength(.1f);
else else
c->SetToolStrength(1.0f); c->SetToolStrength(1.0f);
} }
} }
}
void GameView::disableCtrlBehaviour() void GameView::disableCtrlBehaviour()
{ {

View File

@ -1107,7 +1107,7 @@ void Simulation::ToolBox(int x1, int y1, int x2, int y2, int tool, Brush * cBrus
} }
for (j=y1; j<=y2; j++) for (j=y1; j<=y2; j++)
for (i=x1; i<=x2; i++) for (i=x1; i<=x2; i++)
ToolBrush(i, j, tool, cBrush, strength); Tool(i, j, tool, strength);
} }
int Simulation::CreateParts(int positionX, int positionY, int c, Brush * cBrush) int Simulation::CreateParts(int positionX, int positionY, int c, Brush * cBrush)