X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FAnimation.cpp;h=d4a17d950e127ed0f0316c37b0bd2ce8dba5bd58;hb=0285546b22f9e8f496ca6b1abffdd232647b6b6a;hp=caffb50c653a814ed9d1512e0c1591531d2b5095;hpb=bcbb72013091db29a085d044f200c10d66b7c47a;p=l2e.git diff --git a/src/graphics/Animation.cpp b/src/graphics/Animation.cpp index caffb50..d4a17d9 100644 --- a/src/graphics/Animation.cpp +++ b/src/graphics/Animation.cpp @@ -1,27 +1,25 @@ -/* - * Animation.cpp - * - * Created on: Sep 5, 2012 - * Author: holy - */ - #include "Animation.h" +#include "Sprite.h" +#include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" using loader::FieldDescription; +using loader::Interpreter; using loader::TypeDescription; namespace graphics { -void AddFields(TypeDescription &td, const Animation &a, std::ptrdiff_t offset) { - int boolId(TypeDescription::GetTypeId("Boolean")); - int numberId(TypeDescription::GetTypeId("Number")); - int spriteId(TypeDescription::GetTypeId("Sprite")); +void Animation::CreateTypeDescription() { + TypeDescription &td(TypeDescription::Create(TYPE_ID, "Animation")); + td.SetDescription("Abstract base type for animations."); + td.SetSize(sizeof(Animation)); +} - td.AddField("sprite", FieldDescription(((char *)&a.sprite) - ((char *)&a) - offset, spriteId, true)); - td.AddField("frametime", FieldDescription(((char *)&a.frameTime) - ((char *)&a) - offset, numberId, false)); - td.AddField("repeat", FieldDescription(((char *)&a.repeat) - ((char *)&a) - offset, boolId, false)); +void Animation::AddFields(TypeDescription &td, const Animation &a, std::ptrdiff_t offset) { + td.AddField("sprite", FieldDescription(((char *)&a.sprite) - ((char *)&a) - offset, Sprite::TYPE_ID).SetReferenced().SetDescription("the sprite used for cutting out frames")); + td.AddField("frametime", FieldDescription(((char *)&a.frameTime) - ((char *)&a) - offset, Interpreter::NUMBER_ID).SetDescription("duration of a frame in miliseconds")); + td.AddField("repeat", FieldDescription(((char *)&a.repeat) - ((char *)&a) - offset, Interpreter::BOOLEAN_ID).SetDescription("whether the animation should start over at the beginning after reaching the last frame")); } }