X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FSimpleAnimation.cpp;h=baed3419188b2f393e0e27ade3d3b56f7e38f0f3;hb=0285546b22f9e8f496ca6b1abffdd232647b6b6a;hp=4e16b81658ec4a6dee2eec4a0eaeaffd7a7c2e01;hpb=bcbb72013091db29a085d044f200c10d66b7c47a;p=l2e.git diff --git a/src/graphics/SimpleAnimation.cpp b/src/graphics/SimpleAnimation.cpp index 4e16b81..baed341 100644 --- a/src/graphics/SimpleAnimation.cpp +++ b/src/graphics/SimpleAnimation.cpp @@ -1,15 +1,10 @@ -/* - * SimpleAnimation.cpp - * - * Created on: Sep 5, 2012 - * Author: holy - */ - #include "SimpleAnimation.h" +#include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" using loader::FieldDescription; +using loader::Interpreter; using loader::TypeDescription; namespace graphics { @@ -17,16 +12,21 @@ namespace graphics { void SimpleAnimation::CreateTypeDescription() { SimpleAnimation sa; Animation *a(&sa); - TypeDescription &td(TypeDescription::CreateOrGet("SimpleAnimation")); + TypeDescription &td(TypeDescription::Create(TYPE_ID, "SimpleAnimation")); + td.SetDescription("An animation that uses a fixed column and increasing row of a sprite based on the frame number."); + td.SetConstructor(&Construct); td.SetSize(sizeof(SimpleAnimation)); - td.AddSupertype(TypeDescription::GetTypeId("Animation"), ((char *)a) - ((char *)&sa)); + td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&sa)); - int numberId(TypeDescription::GetTypeId("Number")); + Animation::AddFields(td, sa, ((char *)a) - ((char *)&sa)); + td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("number of frames of a single run")); + td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("the column of the sprite to draw from")); + td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("the row of the sprite of the first frame")); +} - td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), numberId, false)); - td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), numberId, false)); - td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), numberId, false)); +void SimpleAnimation::Construct(void *data) { + new (data) SimpleAnimation; } }