diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-12 17:11:20 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-12 17:11:20 (GMT) |
| commit | c5798c745675e4866a44228ddf161258e85d39a7 (patch) | |
| tree | 6788dbb3c89632f8a1f2acc4038a93faa26b6324 /src/simulation/tools | |
| parent | 16d3895e9c054e908ca8b230719f4294e824a4a2 (diff) | |
| download | powder-c5798c745675e4866a44228ddf161258e85d39a7.zip powder-c5798c745675e4866a44228ddf161258e85d39a7.tar.gz | |
Tools implemented in a similar way to elements
Diffstat (limited to 'src/simulation/tools')
| -rw-r--r-- | src/simulation/tools/Cool.cpp | 19 | ||||
| -rw-r--r-- | src/simulation/tools/Heat.cpp | 19 | ||||
| -rw-r--r-- | src/simulation/tools/SimTool.cpp | 10 | ||||
| -rw-r--r-- | src/simulation/tools/SimTool.h | 23 |
4 files changed, 71 insertions, 0 deletions
diff --git a/src/simulation/tools/Cool.cpp b/src/simulation/tools/Cool.cpp new file mode 100644 index 0000000..12a6b28 --- /dev/null +++ b/src/simulation/tools/Cool.cpp @@ -0,0 +1,19 @@ +#include "simulation/Tools.h" +//#TPT-Directive ToolClass Tool_Cool TOOL_COOL 1 +Tool_Cool::Tool_Cool() +{ + Identifier = "DEFAULT_TOOL_COOL"; + Name = "COOL"; + Colour = PIXPACK(0x00DDFF); + Description = "Cools particles"; +} + +int Tool_Cool::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) +{ + if(!cpart) + return 0; + cpart->temp -= strength; + return 1; +} + +Tool_Cool::~Tool_Cool() {}
\ No newline at end of file diff --git a/src/simulation/tools/Heat.cpp b/src/simulation/tools/Heat.cpp new file mode 100644 index 0000000..a2c500c --- /dev/null +++ b/src/simulation/tools/Heat.cpp @@ -0,0 +1,19 @@ +#include "simulation/Tools.h" +//#TPT-Directive ToolClass Tool_Heat TOOL_HEAT 0 +Tool_Heat::Tool_Heat() +{ + Identifier = "DEFAULT_TOOL_HEAT"; + Name = "HEAT"; + Colour = PIXPACK(0xFFDD00); + Description = "Heats particles"; +} + +int Tool_Heat::Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) +{ + if(!cpart) + return 0; + cpart->temp += strength; + return 1; +} + +Tool_Heat::~Tool_Heat() {}
\ No newline at end of file diff --git a/src/simulation/tools/SimTool.cpp b/src/simulation/tools/SimTool.cpp new file mode 100644 index 0000000..d7015fa --- /dev/null +++ b/src/simulation/tools/SimTool.cpp @@ -0,0 +1,10 @@ +#include "simulation/Element.h" +#include "simulation/Tools.h" + +SimTool::SimTool(): +Identifier("DEFAULT_TOOL_INVALID"), +Name(""), +Colour(PIXPACK(0xFFFFFF)), +Description("NULL Tool, does NOTHING") +{ +}
\ No newline at end of file diff --git a/src/simulation/tools/SimTool.h b/src/simulation/tools/SimTool.h new file mode 100644 index 0000000..0fbcba4 --- /dev/null +++ b/src/simulation/tools/SimTool.h @@ -0,0 +1,23 @@ +#ifndef SIMTOOL_H +#define SIMTOOL_H + +#include "simulation/Simulation.h" +#include "Renderer.h" +#include "simulation/Elements.h" + +class Simulation; +struct Particle; +class SimTool +{ +public: + char *Identifier; + char *Name; + pixel Colour; + char *Description; + + SimTool(); + virtual ~SimTool() {} + virtual int Perform(Simulation * sim, Particle * cpart, int x, int y, float strength) {} +}; + +#endif
\ No newline at end of file |
