diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-21 17:43:46 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-21 17:43:46 (GMT) |
| commit | f7d8556965832821036c210ffc1f9e73f3ff70cc (patch) | |
| tree | 58e985bdc6e99a2ad8e7382ebaf33553ae93d836 /src/game/Tool.cpp | |
| parent | 5bf0a084ace0e6b673efa4552b40de8b36e0668e (diff) | |
| download | powder-f7d8556965832821036c210ffc1f9e73f3ff70cc.zip powder-f7d8556965832821036c210ffc1f9e73f3ff70cc.tar.gz | |
Icons for menu items
Diffstat (limited to 'src/game/Tool.cpp')
| -rw-r--r-- | src/game/Tool.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/game/Tool.cpp b/src/game/Tool.cpp index efe4831..977896b 100644 --- a/src/game/Tool.cpp +++ b/src/game/Tool.cpp @@ -12,15 +12,24 @@ using namespace std; -Tool::Tool(int id, string name, string description, int r, int g, int b): +Tool::Tool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)): toolID(id), toolName(name), toolDescription(description), colRed(r), colGreen(g), - colBlue(b) + colBlue(b), + textureGen(textureGen) { } +VideoBuffer * Tool::GetTexture(int width, int height) +{ + if(textureGen) + { + return textureGen(toolID, width, height); + } + return NULL; +} string Tool::GetName() { return toolName; } string Tool::GetDescription() { return toolDescription; } Tool::~Tool() {} @@ -36,8 +45,8 @@ void Tool::DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Po } void Tool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {}; -ElementTool::ElementTool(int id, string name, string description, int r, int g, int b): - Tool(id, name, description, r, g, b) +ElementTool::ElementTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)): + Tool(id, name, description, r, g, b, textureGen) { } ElementTool::~ElementTool() {} @@ -55,8 +64,8 @@ void ElementTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) } -WallTool::WallTool(int id, string name, string description, int r, int g, int b): -Tool(id, name, description, r, g, b) +WallTool::WallTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)): +Tool(id, name, description, r, g, b, textureGen) { } WallTool::~WallTool() {} @@ -74,8 +83,8 @@ void WallTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) { } -GolTool::GolTool(int id, string name, string description, int r, int g, int b): - Tool(id, name, description, r, g, b) +GolTool::GolTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int)): + Tool(id, name, description, r, g, b, textureGen) { } GolTool::~GolTool() {} |
