diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-03-03 21:38:22 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-03-03 21:38:22 (GMT) |
| commit | 3bbaa1a111e3770d2ce9b04f4b0f9688948d3e85 (patch) | |
| tree | 662d315093f4025c2970e7c6264cfe88effd4e7f /src/game | |
| parent | 732b9d6a0d16f94cd1c39f8e023e369c5837bb9c (diff) | |
| download | powder-3bbaa1a111e3770d2ce9b04f4b0f9688948d3e85.zip powder-3bbaa1a111e3770d2ce9b04f4b0f9688948d3e85.tar.gz | |
Decoration tools - no way to set colour yet
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/DecorationTool.h | 34 | ||||
| -rw-r--r-- | src/game/GameModel.cpp | 10 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/game/DecorationTool.h b/src/game/DecorationTool.h new file mode 100644 index 0000000..b6ab7e3 --- /dev/null +++ b/src/game/DecorationTool.h @@ -0,0 +1,34 @@ + +#ifndef DECORATIONTOOL_H_ +#define DECORATIONTOOL_H_ + +#include "Tool.h" + +class DecorationTool: public Tool +{ +public: + enum ToolType { BlendAdd = DECO_ADD, BlendRemove = DECO_SUBTRACT, BlendMultiply = DECO_MULTIPLY, BlendDivide = DECO_DIVIDE, BlendSet = DECO_DRAW }; + + ToolType decoMode; + + DecorationTool(ToolType decoMode_, string name, int r, int g, int b): + Tool(0, name, r, g, b), + decoMode(decoMode_) + { + } + virtual ~DecorationTool() {} + virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ + sim->ApplyDecorationPoint(position.X, position.Y, 1, 1, 24, 24, 24, 255, decoMode, brush); + } + virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->ApplyDecorationLine(position1.X, position1.Y, position2.X, position2.Y, 1, 1, 24, 24, 24, 255, decoMode, brush); + } + virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { + sim->ApplyDecorationBox(position1.X, position1.Y, position2.X, position2.Y, 24, 24, 24, 255, decoMode); + } + virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { + + } +}; + +#endif diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 80b56f8..099a501 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -7,6 +7,7 @@ #include "Brush.h" #include "EllipseBrush.h" #include "client/Client.h" +#include "game/DecorationTool.h" GameModel::GameModel(): activeTools({NULL, NULL, NULL}), @@ -58,7 +59,7 @@ GameModel::GameModel(): } menuList.clear(); - for(int i = 0; i < 12; i++) + for(int i = 0; i < SC_TOTAL; i++) { menuList.push_back(new Menu((const char)sim->msections[i].icon[0], sim->msections[i].name)); } @@ -87,6 +88,13 @@ GameModel::GameModel(): //sim->wtypes[i] } + //Add decoration tools to menu + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendRemove, "SUB", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendMultiply, "MUL", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendDivide, "DIV", 0, 0, 0)); + menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", 0, 0, 0)); + //Set default brush palette brushList.push_back(new Brush(ui::Point(4, 4))); brushList.push_back(new EllipseBrush(ui::Point(4, 4))); |
