]> git.localhorst.tv Git - l2e.git/commitdiff
added type description of Gauge
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 5 Sep 2012 21:20:27 +0000 (23:20 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 5 Sep 2012 21:20:27 +0000 (23:20 +0200)
src/graphics/Gauge.cpp
src/graphics/Gauge.h

index 0d72ac0676eb11233a5d67df37e795f596e1d70a..7407ba77c2f087f57b69a8af84f51a0f1cde4d9c 100644 (file)
@@ -7,7 +7,11 @@
 
 #include "Gauge.h"
 
+#include "../loader/TypeDescription.h"
+
 using geometry::Vector;
+using loader::FieldDescription;
+using loader::TypeDescription;
 
 namespace graphics {
 
@@ -78,4 +82,24 @@ void Gauge::Draw(SDL_Surface *dest, const Vector<int> &position, int width, Uint
 
 }
 
+
+void Gauge::CreateTypeDescription() {
+       Gauge g;
+       TypeDescription &td(TypeDescription::CreateOrGet("Gauge"));
+
+       td.SetSize(sizeof(Gauge));
+
+       int imageId(TypeDescription::GetTypeId("Image"));
+       int numberId(TypeDescription::GetTypeId("Number"));
+       int vectorId(TypeDescription::GetTypeId("Vector"));
+
+       td.AddField("image", FieldDescription(((char *)&g.surface) - ((char *)&g), imageId, true));
+       td.AddField("full", FieldDescription(((char *)&g.fullOffset) - ((char *)&g), vectorId, false));
+       td.AddField("empty", FieldDescription(((char *)&g.emptyOffset) - ((char *)&g), vectorId, false));
+       td.AddField("height", FieldDescription(((char *)&g.height) - ((char *)&g), numberId, false));
+       td.AddField("start", FieldDescription(((char *)&g.startWidth) - ((char *)&g), numberId, false));
+       td.AddField("repeat", FieldDescription(((char *)&g.repeatWidth) - ((char *)&g), numberId, false));
+       td.AddField("end", FieldDescription(((char *)&g.endWidth) - ((char *)&g), numberId, false));
+}
+
 }
index 3251ec2e0eccf0b7a9d11cce4966ae307964db32..82b8952603f92850772137ae9ca7d14ff435f93e 100644 (file)
@@ -34,6 +34,8 @@ public:
        void SetRepeatWidth(int w) { repeatWidth = w; }
        void SetEndWidth(int w) { endWidth = w; }
 
+       static void CreateTypeDescription();
+
 private:
        SDL_Surface *surface;
        geometry::Vector<int> fullOffset;