Special ligh placement

This commit is contained in:
Simon Robertshaw 2012-07-19 17:49:40 +01:00
parent c2873180e2
commit 4d961117bd
3 changed files with 37 additions and 4 deletions

View File

@ -61,7 +61,15 @@ GameModel::GameModel():
{
if(sim->elements[i].MenuSection < 12 && sim->elements[i].Enabled && sim->elements[i].MenuVisible)
{
Tool * 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));
Tool * tempTool;
if(i == PT_LIGH)
{
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
{
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));
}
menuList[sim->elements[i].MenuSection]->AddTool(tempTool);
}
}
@ -88,7 +96,8 @@ GameModel::GameModel():
//Build menu for simtools
for(int i = 0; i < sim->tools.size(); i++)
{
Tool * tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour));
Tool * tempTool;
tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour));
menuList[SC_TOOL]->AddTool(tempTool);
}

View File

@ -92,5 +92,14 @@ void GolTool::DrawFill(Simulation * sim, Brush * brush, ui::Point position) {
sim->FloodParts(position.X, position.Y, PT_LIFE|(toolID<<8), -1, -1, 0);
}
void Element_LIGH_Tool::Draw(Simulation * sim, Brush * brush, ui::Point position)
{
int p = sim->create_part(-2, position.X, position.Y, toolID);
if (p != -1)
{
sim->parts[p].life = brush->GetRadius().X+brush->GetRadius().Y;
if (sim->parts[p].life > 55)
sim->parts[p].life = 55;
sim->parts[p].temp = sim->parts[p].life*150; // temperature of the lighting shows the power of the lighting
}
}

View File

@ -66,6 +66,21 @@ public:
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class Element_LIGH_Tool: public Tool
{
public:
Element_LIGH_Tool(int id, string name, string description, int r, int g, int b):
Tool(id, name, description, r, g, b)
{
}
virtual ~Element_LIGH_Tool() {}
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) { }
virtual void DrawRect(Simulation * sim, Brush * brush, ui::Point position1, ui::Point position2) { }
virtual void DrawFill(Simulation * sim, Brush * brush, ui::Point position) { }
};
class ElementTool: public Tool
{
public: