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

index ca06a076a80c251a17f7fead31171d7ce5c6a1a3..c68031065b717486f55d06bb589d124b84d0228a 100644 (file)
@@ -7,10 +7,14 @@
 
 #include "Font.h"
 
+#include "../loader/TypeDescription.h"
+
 #include <cmath>
 #include <iostream>
 
 using geometry::Vector;
+using loader::FieldDescription;
+using loader::TypeDescription;
 using std::pow;
 
 namespace graphics {
@@ -70,4 +74,19 @@ void Font::DrawNumber(int numberIn, SDL_Surface *dest, const Vector<int> &positi
        }
 }
 
+
+void Font::CreateTypeDescription() {
+       Font f;
+       TypeDescription &td(TypeDescription::CreateOrGet("Font"));
+
+       td.SetSize(sizeof(Font));
+
+       int numberId(TypeDescription::GetTypeId("Number"));
+       int spriteId(TypeDescription::GetTypeId("Sprite"));
+
+       td.AddField("sprite", FieldDescription(((char *)&f.sprite) - ((char *)&f), spriteId, true));
+       td.AddField("columnoffset", FieldDescription(((char *)&f.colOffset) - ((char *)&f), numberId, false));
+       td.AddField("rowoffset", FieldDescription(((char *)&f.rowOffset) - ((char *)&f), numberId, false));
+}
+
 }
index 571431df74dca406a73572c881669eda69208513..8b365252c79fdb966ef1b287850557808d0aad26 100644 (file)
@@ -36,6 +36,8 @@ public:
        void SetColOffset(int n) { colOffset = n; }
        void SetRowOffset(int n) { rowOffset = n; }
 
+       static void CreateTypeDescription();
+
 private:
        const Sprite *sprite;
        int colOffset;