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

index 14856071662a8ba80494c6b536c4b1cc71e9fbf8..34767f53f0cd170185723e2a0806f4cd87ab14bf 100644 (file)
@@ -7,7 +7,11 @@
 
 #include "Frame.h"
 
+#include "../loader/TypeDescription.h"
+
 using geometry::Vector;
+using loader::FieldDescription;
+using loader::TypeDescription;
 
 namespace graphics {
 
@@ -114,4 +118,20 @@ void Frame::Draw(SDL_Surface *dest, const Vector<int> &position, int width, int
        SDL_BlitSurface(surface, &srcRect, dest, &destRect);
 }
 
+
+void Frame::CreateTypeDescription() {
+       Frame f;
+       TypeDescription &td(TypeDescription::CreateOrGet("Frame"));
+
+       td.SetSize(sizeof(Frame));
+
+       int imageId(TypeDescription::GetTypeId("Image"));
+       int vectorId(TypeDescription::GetTypeId("Vector"));
+
+       td.AddField("surface", FieldDescription(((char *)&f.surface) - ((char *)&f), imageId, true));
+       td.AddField("borderSize", FieldDescription(((char *)&f.borderSize) - ((char *)&f), vectorId, false));
+       td.AddField("repeatSize", FieldDescription(((char *)&f.repeatSize) - ((char *)&f), vectorId, false));
+       td.AddField("offset", FieldDescription(((char *)&f.offset) - ((char *)&f), vectorId, false));
+}
+
 }
index 59aa1fb0c74486b99c05be713030cd5a9d7a9650..75bd6056c4204b761f2bf1472629497f76c1212d 100644 (file)
@@ -37,6 +37,8 @@ public:
        void SetRepeatSize(const geometry::Vector<int> &s) { repeatSize = s; }
        void SetOffset(const geometry::Vector<int> &o) { offset = o; }
 
+       static void CreateTypeDescription();
+
 private:
        SDL_Surface *surface;
        geometry::Vector<int> borderSize;