1 #include "SimpleAnimation.h"
3 #include "../loader/Interpreter.h"
4 #include "../loader/TypeDescription.h"
6 using loader::FieldDescription;
7 using loader::Interpreter;
8 using loader::TypeDescription;
12 void SimpleAnimation::CreateTypeDescription() {
16 TypeDescription &td(TypeDescription::Create(TYPE_ID, "SimpleAnimation"));
17 td.SetDescription("An animation that uses a fixed column and increasing row of a sprite based on the frame number.");
18 td.SetConstructor(&Construct);
19 td.SetSize(sizeof(SimpleAnimation));
20 td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&sa));
22 Animation::AddFields(td, sa, ((char *)a) - ((char *)&sa));
23 td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("number of frames of a single run"));
24 td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("the column of the sprite to draw from"));
25 td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), Interpreter::NUMBER_ID).SetDescription("the row of the sprite of the first frame"));
28 void SimpleAnimation::Construct(void *data) {
29 new (data) SimpleAnimation;