X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FSimpleAnimation.cpp;h=91620648ba7ae4107c2751a67b4668036cdae5c4;hb=1907ca03c5e865c4d398170042aa384c67ffff29;hp=7ed79931257a64e39a447ed83501abcd76dc0f04;hpb=fb9bd716a1740e41efbb08a3bfa42e441d64c693;p=l2e.git diff --git a/src/graphics/SimpleAnimation.cpp b/src/graphics/SimpleAnimation.cpp index 7ed7993..9162064 100644 --- a/src/graphics/SimpleAnimation.cpp +++ b/src/graphics/SimpleAnimation.cpp @@ -7,9 +7,11 @@ #include "SimpleAnimation.h" +#include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" using loader::FieldDescription; +using loader::Interpreter; using loader::TypeDescription; namespace graphics { @@ -18,21 +20,16 @@ void SimpleAnimation::CreateTypeDescription() { SimpleAnimation sa; Animation *a(&sa); - int animationId(TypeDescription::GetTypeId("Animation")); - int boolId(TypeDescription::GetTypeId("Boolean")); - int numberId(TypeDescription::GetTypeId("Number")); - int spriteId(TypeDescription::GetTypeId("Sprite")); - - 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(animationId, ((char *)a) - ((char *)&sa)); + td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&sa)); - Animation::AddFields(td, sa, ((char *)a) - ((char *)&sa), boolId, numberId, spriteId); - td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), numberId).SetDescription("number of frames of a single run")); - td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), numberId).SetDescription("the column of the sprite to draw from")); - td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), numberId).SetDescription("the row of the sprite of the first frame")); + 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")); } void SimpleAnimation::Construct(void *data) {