diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-12 17:11:20 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-12 17:11:20 (GMT) |
| commit | c5798c745675e4866a44228ddf161258e85d39a7 (patch) | |
| tree | 6788dbb3c89632f8a1f2acc4038a93faa26b6324 /src/game | |
| parent | 16d3895e9c054e908ca8b230719f4294e824a4a2 (diff) | |
| download | powder-c5798c745675e4866a44228ddf161258e85d39a7.zip powder-c5798c745675e4866a44228ddf161258e85d39a7.tar.gz | |
Tools implemented in a similar way to elements
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameModel.cpp | 7 | ||||
| -rw-r--r-- | src/game/Tool.h | 12 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 453232f..c040566 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -92,6 +92,13 @@ GameModel::GameModel(): menuList[SC_WALL]->AddTool(tempTool); //sim->wtypes[i] } + + //Build menu for simtools + for(int i = 0; i < sim->tools.size(); i++) + { + Tool * tempTool = new Tool(i, sim->tools[i]->Name, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour)); + menuList[SC_TOOL]->AddTool(tempTool); + } //Add decoration tools to menu menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", 0, 0, 0)); diff --git a/src/game/Tool.h b/src/game/Tool.h index 107c8cc..9f88188 100644 --- a/src/game/Tool.h +++ b/src/game/Tool.h @@ -28,9 +28,15 @@ public: } string GetName() { return toolName; } virtual ~Tool() {} - virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) {} - virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {} - virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {} + virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) { + sim->ToolBrush(position.X, position.Y, toolID, brush); + } + virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->ToolLine(position1.X, position1.Y, position2.X, position2.Y, toolID, brush); + } + virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->ToolBox(position1.X, position1.Y, position2.X, position2.Y, toolID, brush); + } virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) {}; int colRed, colBlue, colGreen; }; |
