4 * Created on: Sep 5, 2012
8 #include "SimpleAnimation.h"
10 #include "../loader/Interpreter.h"
11 #include "../loader/TypeDescription.h"
13 using loader::FieldDescription;
14 using loader::Interpreter;
15 using loader::TypeDescription;
19 void SimpleAnimation::CreateTypeDescription() {
23 TypeDescription &td(TypeDescription::Create(TYPE_ID, "SimpleAnimation"));
24 td.SetDescription("An animation that uses a fixed column and increasing row of a sprite based on the frame number.");
25 td.SetConstructor(&Construct);
26 td.SetSize(sizeof(SimpleAnimation));
27 td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&sa));
29 Animation::AddFields(td, sa, ((char *)a) - ((char *)&sa));
30 td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("number of frames of a single run"));
31 td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("the column of the sprite to draw from"));
32 td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("the row of the sprite of the first frame"));
35 void SimpleAnimation::Construct(void *data) {
36 new (data) SimpleAnimation;