X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FAnimation.cpp;fp=src%2Fgraphics%2FAnimation.cpp;h=03bef18cf44ba321b56a551ec2d918fa3a181d07;hb=1907ca03c5e865c4d398170042aa384c67ffff29;hp=2534a267f2f22379ccded70bcf232871a3d4ad60;hpb=fb9bd716a1740e41efbb08a3bfa42e441d64c693;p=l2e.git diff --git a/src/graphics/Animation.cpp b/src/graphics/Animation.cpp index 2534a26..03bef18 100644 --- a/src/graphics/Animation.cpp +++ b/src/graphics/Animation.cpp @@ -7,17 +7,26 @@ #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 Animation::AddFields(TypeDescription &td, const Animation &a, std::ptrdiff_t offset, int boolId, int numberId, int spriteId) { - td.AddField("sprite", FieldDescription(((char *)&a.sprite) - ((char *)&a) - offset, spriteId).SetReferenced().SetDescription("the sprite used for cutting out frames")); - td.AddField("frametime", FieldDescription(((char *)&a.frameTime) - ((char *)&a) - offset, numberId).SetDescription("duration of a frame in miliseconds")); - td.AddField("repeat", FieldDescription(((char *)&a.repeat) - ((char *)&a) - offset, boolId).SetDescription("whether the animation should start over at the beginning after reaching the last frame")); +void Animation::CreateTypeDescription() { + TypeDescription &td(TypeDescription::Create(TYPE_ID, "Animation")); + td.SetDescription("Abstract base type for animations."); + td.SetSize(sizeof(Animation)); +} + +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")); } }