summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-07-24 12:03:28 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-07-24 12:03:28 (GMT)
commite65e222f2ccbf60a4c224bbe29884ebb1001cfd7 (patch)
treef987b4cf48934bb8c4c2049324df34ba5d934c06 /src/game
parent64ebd1117b2adfb117c3974ee73ddbe3df0b6c02 (diff)
downloadpowder-e65e222f2ccbf60a4c224bbe29884ebb1001cfd7.zip
powder-e65e222f2ccbf60a4c224bbe29884ebb1001cfd7.tar.gz
Integer values for prefs, Default decoration colour, clear decoration
Diffstat (limited to 'src/game')
-rw-r--r--src/game/DecorationTool.h6
-rw-r--r--src/game/GameModel.cpp18
2 files changed, 20 insertions, 4 deletions
diff --git a/src/game/DecorationTool.h b/src/game/DecorationTool.h
index be79e6b..e2e4758 100644
--- a/src/game/DecorationTool.h
+++ b/src/game/DecorationTool.h
@@ -7,7 +7,7 @@
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 };
+ 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;
@@ -27,10 +27,10 @@ public:
}
virtual ~DecorationTool() {}
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){
- sim->ApplyDecorationPoint(position.X, position.Y, 1, 1, Red, Green, Blue, Alpha, decoMode, brush);
+ sim->ApplyDecorationPoint(position.X, position.Y, Red, Green, Blue, Alpha, 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, Red, Green, Blue, Alpha, decoMode, brush);
+ sim->ApplyDecorationLine(position1.X, position1.Y, position2.X, position2.Y, Red, Green, Blue, Alpha, 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, Red, Green, Blue, Alpha, decoMode);
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 29d13ce..f3ce1bc 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -20,7 +20,8 @@ GameModel::GameModel():
colourSelector(false),
clipboard(NULL),
stamp(NULL),
- placeSave(NULL)
+ placeSave(NULL),
+ colour(255, 0, 0, 255)
{
sim = new Simulation();
ren = new Renderer(ui::Engine::Ref().g, sim);
@@ -108,6 +109,7 @@ GameModel::GameModel():
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendDivide, "DIV", "Colour blending: Divide" , 0, 0, 0));
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSmudge, "SMDG", "Smudge colour", 0, 0, 0));
menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendSet, "SET", "Set colour (No blending)", 0, 0, 0));
+ menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::Remove, "CLR", "Clear any set decoration", 0, 0, 0));
//Set default brush palette
brushList.push_back(new EllipseBrush(ui::Point(4, 4)));
@@ -135,6 +137,15 @@ GameModel::GameModel():
if(stampFile && stampFile->GetGameSave())
stamp = stampFile->GetGameSave();
}
+
+
+ //Set default decoration colour
+ unsigned char colourR = min(Client::Ref().GetPrefInteger("Decoration.Red", 200), 255);
+ unsigned char colourG = min(Client::Ref().GetPrefInteger("Decoration.Green", 100), 255);
+ unsigned char colourB = min(Client::Ref().GetPrefInteger("Decoration.Blue", 50), 255);
+ unsigned char colourA = min(Client::Ref().GetPrefInteger("Decoration.Alpha", 255), 255);
+
+ SetColourSelectorColour(ui::Colour(colourR, colourG, colourB, colourA));
}
GameModel::~GameModel()
@@ -148,6 +159,11 @@ GameModel::~GameModel()
std::vector<unsigned int> renderModes = ren->GetRenderMode();
Client::Ref().SetPref("Renderer.RenderModes", std::vector<double>(renderModes.begin(), renderModes.end()));
+ Client::Ref().SetPref("Decoration.Red", (int)colour.Red);
+ Client::Ref().SetPref("Decoration.Green", (int)colour.Green);
+ Client::Ref().SetPref("Decoration.Blue", (int)colour.Blue);
+ Client::Ref().SetPref("Decoration.Alpha", (int)colour.Alpha);
+
for(int i = 0; i < menuList.size(); i++)
{
delete menuList[i];