Cut region, fixes #105
This commit is contained in:
parent
70758cc70e
commit
e13476a406
@ -432,6 +432,12 @@ void GameController::CopyRegion(ui::Point point1, ui::Point point2)
|
||||
gameModel->SetClipboard(newSave);
|
||||
}
|
||||
|
||||
void GameController::CutRegion(ui::Point point1, ui::Point point2)
|
||||
{
|
||||
CopyRegion(point1, point2);
|
||||
gameModel->GetSimulation()->clear_area(point1.X, point1.Y, point2.X-point1.X, point2.Y-point1.Y);
|
||||
}
|
||||
|
||||
bool GameController::MouseMove(int x, int y, int dx, int dy)
|
||||
{
|
||||
return commandInterface->OnMouseMove(x, y, dx, dy);
|
||||
|
@ -81,6 +81,7 @@ public:
|
||||
void DrawFill(int toolSelection, ui::Point point);
|
||||
void StampRegion(ui::Point point1, ui::Point point2);
|
||||
void CopyRegion(ui::Point point1, ui::Point point2);
|
||||
void CutRegion(ui::Point point1, ui::Point point2);
|
||||
void Update();
|
||||
void SetPaused(bool pauseState);
|
||||
void SetPaused();
|
||||
|
@ -1032,6 +1032,8 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
|
||||
{
|
||||
if(selectMode==SelectCopy)
|
||||
c->CopyRegion(ui::Point(x1, y1), ui::Point(x2, y2));
|
||||
else if(selectMode==SelectCut)
|
||||
c->CutRegion(ui::Point(x1, y1), ui::Point(x2, y2));
|
||||
else if(selectMode==SelectStamp)
|
||||
c->StampRegion(ui::Point(x1, y1), ui::Point(x2, y2));
|
||||
}
|
||||
@ -1299,6 +1301,15 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
||||
infoTipPresence = 120;
|
||||
}
|
||||
break;
|
||||
case 'x':
|
||||
if(ctrl)
|
||||
{
|
||||
selectMode = SelectCut;
|
||||
selectPoint1 = ui::Point(-1, -1);
|
||||
infoTip = "\x0F\xEF\xEF\x10Select an area to cut";
|
||||
infoTipPresence = 120;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
if(ctrl)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ enum DrawMode
|
||||
|
||||
enum SelectMode
|
||||
{
|
||||
SelectNone, SelectStamp, SelectCopy, PlaceSave
|
||||
SelectNone, SelectStamp, SelectCopy, SelectCut, PlaceSave
|
||||
};
|
||||
|
||||
class GameController;
|
||||
|
Loading…
Reference in New Issue
Block a user