Use plop tool to place single units of an element (Used for Stickman, Fighter), fixes issue 53

This commit is contained in:
Simon Robertshaw 2012-08-03 18:26:06 +01:00
parent 9260b2c3e8
commit 0e5c3da0f5
3 changed files with 24 additions and 0 deletions

View File

@ -169,6 +169,10 @@ void GameModel::BuildMenus()
{
tempTool = new Element_LIGH_Tool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
}
else if(i == PT_STKM || i == PT_FIGH || i == PT_STKM2)
{
tempTool = new PlopTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));
}
else
{
tempTool = new ElementTool(i, sim->elements[i].Name, sim->elements[i].Description, PIXR(sim->elements[i].Colour), PIXG(sim->elements[i].Colour), PIXB(sim->elements[i].Colour));

View File

@ -152,3 +152,8 @@ void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position
sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting
}
}
void PlopTool::Click(Simulation * sim, Brush * brush, ui::Point position)
{
sim->create_part(-1, position.X, position.Y, toolID);
}

View File

@ -96,6 +96,21 @@ public:
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position);
};
class PlopTool: public ElementTool
{
public:
PlopTool(int id, string name, string description, int r, int g, int b, VideoBuffer * (*textureGen)(int, int, int) = NULL):
ElementTool(id, name, description, r, g, b)
{
}
virtual ~PlopTool() {}
virtual void Draw(Simulation * sim, Brush * brush, ui::Point position) {}
virtual void Click(Simulation * sim, Brush * brush, ui::Point position);
virtual void DrawLine(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2, bool dragging = false) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class WallTool: public Tool
{
public: