summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Particle.cpp27
-rw-r--r--src/simulation/Particle.h19
-rw-r--r--src/simulation/StructProperty.h2
3 files changed, 31 insertions, 17 deletions
diff --git a/src/simulation/Particle.cpp b/src/simulation/Particle.cpp
new file mode 100644
index 0000000..115ed95
--- /dev/null
+++ b/src/simulation/Particle.cpp
@@ -0,0 +1,27 @@
+/*
+ * Particle.cpp
+ *
+ * Created on: Jun 6, 2012
+ * Author: Simon
+ */
+
+#include <cstddef>
+#include "Particle.h"
+
+std::vector<StructProperty> Particle::GetProperties()
+{
+ std::vector<StructProperty> properties;
+ properties.push_back(StructProperty("type", StructProperty::ParticleType, offsetof(Particle, type)));
+ properties.push_back(StructProperty("life", StructProperty::ParticleType, offsetof(Particle, life)));
+ properties.push_back(StructProperty("ctype", StructProperty::ParticleType, offsetof(Particle, ctype)));
+ properties.push_back(StructProperty("x", StructProperty::Float, offsetof(Particle, x)));
+ properties.push_back(StructProperty("y", StructProperty::Float, offsetof(Particle, y)));
+ properties.push_back(StructProperty("vx", StructProperty::Float, offsetof(Particle, vx)));
+ properties.push_back(StructProperty("vy", StructProperty::Float, offsetof(Particle, vy)));
+ properties.push_back(StructProperty("temp", StructProperty::Float, offsetof(Particle, temp)));
+ properties.push_back(StructProperty("flags", StructProperty::UInteger, offsetof(Particle, flags)));
+ properties.push_back(StructProperty("tmp", StructProperty::Integer, offsetof(Particle, tmp)));
+ properties.push_back(StructProperty("tmp2", StructProperty::Integer, offsetof(Particle, tmp2)));
+ properties.push_back(StructProperty("dcolour", StructProperty::UInteger, offsetof(Particle, dcolour)));
+ return properties;
+}
diff --git a/src/simulation/Particle.h b/src/simulation/Particle.h
index 91a1315..bb0297e 100644
--- a/src/simulation/Particle.h
+++ b/src/simulation/Particle.h
@@ -9,6 +9,7 @@
#ifndef The_Powder_Toy_Particle_h
#define The_Powder_Toy_Particle_h
+#include <vector>
#include "StructProperty.h"
struct Particle
@@ -24,23 +25,7 @@ struct Particle
unsigned int dcolour;
/** Returns a list of properties, their type and offset within the structure that can be changed
by higher-level processes refering to them by name such as Lua or the property tool **/
- static std::vector<StructProperty> GetProperties()
- {
- std::vector<StructProperty> properties;
- properties.push_back(StructProperty("type", StructProperty::ParticleType, offsetof(Particle, type)));
- properties.push_back(StructProperty("life", StructProperty::ParticleType, offsetof(Particle, life)));
- properties.push_back(StructProperty("ctype", StructProperty::ParticleType, offsetof(Particle, ctype)));
- properties.push_back(StructProperty("x", StructProperty::Float, offsetof(Particle, x)));
- properties.push_back(StructProperty("y", StructProperty::Float, offsetof(Particle, y)));
- properties.push_back(StructProperty("vx", StructProperty::Float, offsetof(Particle, vx)));
- properties.push_back(StructProperty("vy", StructProperty::Float, offsetof(Particle, vy)));
- properties.push_back(StructProperty("temp", StructProperty::Float, offsetof(Particle, temp)));
- properties.push_back(StructProperty("flags", StructProperty::UInteger, offsetof(Particle, flags)));
- properties.push_back(StructProperty("tmp", StructProperty::Integer, offsetof(Particle, tmp)));
- properties.push_back(StructProperty("tmp2", StructProperty::Integer, offsetof(Particle, tmp2)));
- properties.push_back(StructProperty("dcolour", StructProperty::UInteger, offsetof(Particle, dcolour)));
- return properties;
- }
+ static std::vector<StructProperty> GetProperties();
};
#endif
diff --git a/src/simulation/StructProperty.h b/src/simulation/StructProperty.h
index ddea96b..832e83b 100644
--- a/src/simulation/StructProperty.h
+++ b/src/simulation/StructProperty.h
@@ -9,6 +9,8 @@
#ifndef The_Powder_Toy_StructProperty_h
#define The_Powder_Toy_StructProperty_h
+#include <string>
+
struct StructProperty
{
enum PropertyType { ParticleType, Colour, Integer, UInteger, Float, String };