#include "Sprite.h"
+#include "../loader/TypeDescription.h"
+
using geometry::Vector;
+using loader::FieldDescription;
+using loader::TypeDescription;
namespace graphics {
}
}
+
+void Sprite::CreateTypeDescription() {
+ Sprite s;
+ TypeDescription &td(TypeDescription::CreateOrGet("Sprite"));
+
+ td.SetSize(sizeof(Sprite));
+
+ int imageId(TypeDescription::GetTypeId("Image"));
+ int vectorId(TypeDescription::GetTypeId("Vector"));
+
+ td.AddField("image", FieldDescription(((char *)&s.surface) - ((char *)&s), imageId, true));
+ td.AddField("size", FieldDescription(((char *)&s.size) - ((char *)&s), vectorId, false));
+ td.AddField("offset", FieldDescription(((char *)&s.offset) - ((char *)&s), vectorId, false));
+}
+
}
void SetSize(const geometry::Vector<int> &s) { size = s; }
void SetOffset(const geometry::Vector<int> &o) { offset = o; }
+ static void CreateTypeDescription();
+
private:
SDL_Surface *surface;
geometry::Vector<int> size;