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,25 +1142,31 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
enableAltBehaviour();
break;
case KEY_CTRL:
if(drawModeReset)
drawModeReset = false;
else
drawPoint1 = currentMouse;
if(shift)
drawMode = DrawFill;
else
drawMode = DrawRect;
if(!isMouseDown)
{
if(drawModeReset)
drawModeReset = false;
else
drawPoint1 = currentMouse;
if(shift)
drawMode = DrawFill;
else
drawMode = DrawRect;
}
enableCtrlBehaviour();
break;
case KEY_SHIFT:
if(drawModeReset)
drawModeReset = false;
else
drawPoint1 = currentMouse;
if(ctrl)
drawMode = DrawFill;
else
drawMode = DrawLine;
if(!isMouseDown)
{
if(drawModeReset)
drawModeReset = false;
else
drawPoint1 = currentMouse;
if(ctrl)
drawMode = DrawFill;
else
drawMode = DrawLine;
}
enableShiftBehaviour();
break;
case ' ': //Space
@ -1538,10 +1544,13 @@ void GameView::enableShiftBehaviour()
if(!shiftBehaviour)
{
shiftBehaviour = true;
if(!ctrlBehaviour)
c->SetToolStrength(10.0f);
else
c->SetToolStrength(1.0f);
if(isMouseDown)
{
if(!ctrlBehaviour)
c->SetToolStrength(10.0f);
else
c->SetToolStrength(1.0f);
}
}
}
@ -1584,10 +1593,13 @@ void GameView::enableCtrlBehaviour()
saveSimulationButton->Appearance.TextInactive = ui::Colour(0, 0, 0);
searchButton->Appearance.BackgroundInactive = ui::Colour(255, 255, 255);
searchButton->Appearance.TextInactive = ui::Colour(0, 0, 0);
if(!shiftBehaviour)
c->SetToolStrength(.1f);
else
c->SetToolStrength(1.0f);
if(isMouseDown)
{
if(!shiftBehaviour)
c->SetToolStrength(.1f);
else
c->SetToolStrength(1.0f);
}
}
}

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 (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)