diff options
Diffstat (limited to 'src/gui/game/DecorationTool.h')
| -rw-r--r-- | src/gui/game/DecorationTool.h | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/gui/game/DecorationTool.h b/src/gui/game/DecorationTool.h index 679c854..67ab915 100644 --- a/src/gui/game/DecorationTool.h +++ b/src/gui/game/DecorationTool.h @@ -3,22 +3,59 @@ #define DECORATIONTOOL_H_ #include "Tool.h" +#include "graphics/Graphics.h" class DecorationTool: public Tool { public: - enum ToolType { BlendAdd = DECO_ADD, BlendRemove = DECO_SUBTRACT, BlendMultiply = DECO_MULTIPLY, BlendDivide = DECO_DIVIDE, BlendSet = DECO_DRAW, BlendSmudge = DECO_SMUDGE, Remove = DECO_CLEAR }; - - ToolType decoMode; - unsigned char Red; unsigned char Green; unsigned char Blue; unsigned char Alpha; - DecorationTool(ToolType decoMode_, string name, string description, int r, int g, int b, std::string identifier): - Tool(0, name, description, r, g, b, identifier), - decoMode(decoMode_), + VideoBuffer * GetIcon(int toolID, int width, int height) + { + VideoBuffer * newTexture = new VideoBuffer(width, height); + for (int y=0; y<height; y++) + { + for (int x=0; x<width; x++) + { + //if (toolID == DECO_LIGH) + // vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXRGB(PIXR(pc)-10*j, PIXG(pc)-10*j, PIXB(pc)-10*j); + //else if (toolID == DECO_DARK) + // vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXRGB(PIXR(pc)+10*j, PIXG(pc)+10*j, PIXB(pc)+10*j); + if (toolID == DECO_SMUDGE) + newTexture->SetPixel(x, y, 0, 255-5*x, 255+5*x, 255); + else + newTexture->SetPixel(x, y, Red, Green, Blue, Alpha); + } + } + int reverseRed = (Red+127)%256; + int reverseGreen = (Green+127)%256; + int reverseBlue = (Blue+127)%256; + if (toolID == DECO_CLEAR) + { + for (int y=4; y<12; y++) + { + newTexture->SetPixel(y+5, y-1, reverseRed, reverseGreen, reverseBlue, 255); + newTexture->SetPixel(y+6, y-1, reverseRed, reverseGreen, reverseBlue, 255); + newTexture->SetPixel(20-y, y-1, reverseRed, reverseGreen, reverseBlue, 255); + newTexture->SetPixel(21-y, y-1, reverseRed, reverseGreen, reverseBlue, 255); + } + } + else if (toolID == DECO_ADD) + newTexture->AddCharacter(11, 4, '+', reverseRed, reverseGreen, reverseBlue, 255); + else if (toolID == DECO_SUBTRACT) + newTexture->AddCharacter(11, 4, '-', reverseRed, reverseGreen, reverseBlue, 255); + else if (toolID == DECO_MULTIPLY) + newTexture->AddCharacter(11, 3, 'x', reverseRed, reverseGreen, reverseBlue, 255); + else if (toolID == DECO_DIVIDE) + newTexture->AddCharacter(11, 4, '/', reverseRed, reverseGreen, reverseBlue, 255); + return newTexture; + } + + DecorationTool(int decoMode, string name, string description, int r, int g, int b, std::string identifier): + Tool(decoMode, name, description, r, g, b, identifier), Red(0), Green(0), Blue(0), @@ -27,13 +64,13 @@ public: } virtual ~DecorationTool() {} virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){ - sim->ApplyDecorationPoint(position.X, position.Y, Red, Green, Blue, Alpha, decoMode, brush); + sim->ApplyDecorationPoint(position.X, position.Y, Red, Green, Blue, Alpha, toolID, brush); } virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging) { - sim->ApplyDecorationLine(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, decoMode, brush); + sim->ApplyDecorationLine(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, toolID, brush); } virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { - sim->ApplyDecorationBox(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, decoMode); + sim->ApplyDecorationBox(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, toolID); } virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { |
