From: Daniel Karbach Date: Wed, 5 Sep 2012 21:06:38 +0000 (+0200) Subject: added type description of Frame X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=76ebf3fdefce0655ecd2404e735e8fd96347d934;p=l2e.git added type description of Frame --- diff --git a/src/graphics/Frame.cpp b/src/graphics/Frame.cpp index 1485607..34767f5 100644 --- a/src/graphics/Frame.cpp +++ b/src/graphics/Frame.cpp @@ -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 &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)); +} + } diff --git a/src/graphics/Frame.h b/src/graphics/Frame.h index 59aa1fb..75bd605 100644 --- a/src/graphics/Frame.h +++ b/src/graphics/Frame.h @@ -37,6 +37,8 @@ public: void SetRepeatSize(const geometry::Vector &s) { repeatSize = s; } void SetOffset(const geometry::Vector &o) { offset = o; } + static void CreateTypeDescription(); + private: SDL_Surface *surface; geometry::Vector borderSize;