summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-02-02 00:33:10 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-02-02 00:33:10 (GMT)
commitf5dd32b284fd311dd58070b6f431ec535fa93387 (patch)
tree73de79c18b3a91e72ebdb8520694ed7fd57c5999 /src/game
parentf86091d421989ead46940cc12b77e48cfb127608 (diff)
downloadpowder-f5dd32b284fd311dd58070b6f431ec535fa93387.zip
powder-f5dd32b284fd311dd58070b6f431ec535fa93387.tar.gz
Working GOL (No graphics
Diffstat (limited to 'src/game')
-rw-r--r--src/game/GameModel.cpp6
-rw-r--r--src/game/Tool.h19
2 files changed, 24 insertions, 1 deletions
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 4fe65ea..c026da8 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -35,7 +35,11 @@ GameModel::GameModel():
}
//Build menu for GOL types
- //for(int i = 0; i < GOL_)
+ for(int i = 0; i < NGOL; i++)
+ {
+ Tool * tempTool = new GolTool(i, sim->gmenu[i].name, PIXR(sim->gmenu[i].colour), PIXG(sim->gmenu[i].colour), PIXB(sim->gmenu[i].colour));
+ menuList[SC_LIFE]->AddTool(tempTool);
+ }
//Build other menus from wall data
for(int i = 0; i < UI_WALLCOUNT; i++)
diff --git a/src/game/Tool.h b/src/game/Tool.h
index 440ee62..bffa967 100644
--- a/src/game/Tool.h
+++ b/src/game/Tool.h
@@ -53,4 +53,23 @@ public:
}
};
+class GolTool: public Tool
+{
+public:
+ GolTool(int id, string name, int r, int g, int b):
+ Tool(id, name, r, g, b)
+ {
+ }
+ virtual ~GolTool() {}
+ virtual void Draw(Simulation * sim, Brush * brush, ui::Point position){
+ sim->create_parts(position.X, position.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush);
+ }
+ virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {
+ sim->create_line(position1.X, position1.Y, position2.X, position2.Y, 1, 1, PT_LIFE|(toolID<<8), 0, brush);
+ }
+ virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) {
+ sim->create_box(position1.X, position1.Y, position2.X, position2.Y, PT_LIFE|(toolID<<8), 0);
+ }
+};
+
#endif /* TOOL_H_ */