]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Texture.cpp
moved menu resources to data files
[l2e.git] / src / graphics / Texture.cpp
index f4a0385897ec42da9108363f01be7e7fda32684e..f53c82fd7030f6219332e5368ae1d435b4a4481e 100644 (file)
@@ -1,8 +1,13 @@
 #include "Texture.h"
 
+#include "../loader/Interpreter.h"
+#include "../loader/TypeDescription.h"
 #include "../sdl/utility.h"
 
 using geometry::Vector;
+using loader::FieldDescription;
+using loader::Interpreter;
+using loader::TypeDescription;
 
 namespace graphics {
 
@@ -55,4 +60,21 @@ void Texture::Render(SDL_Surface *dest, const Vector<int> &from, const Vector<in
        }
 }
 
+
+void Texture::CreateTypeDescription() {
+       Texture t;
+
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "Texture"));
+       td.SetConstructor(&Construct);
+       td.SetSize(sizeof(Texture));
+
+       td.AddField("image", FieldDescription(((char *)&t.surface) - ((char *)&t), Interpreter::IMAGE_ID).SetReferenced().SetDescription("image containing the texture"));
+       td.AddField("size", FieldDescription(((char *)&t.size) - ((char *)&t), Interpreter::VECTOR_ID).SetDescription("offset into the image in pixels"));
+       td.AddField("offset", FieldDescription(((char *)&t.offset) - ((char *)&t), Interpreter::VECTOR_ID).SetDescription("size of the texture in pixels"));
+}
+
+void Texture::Construct(void *data) {
+       new (data) Texture;
+}
+
 }