1 #include "ComplexAnimation.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 ComplexAnimation::CreateTypeDescription() {
16 TypeDescription &td(TypeDescription::Create(TYPE_ID, "ComplexAnimation"));
17 td.SetDescription("Complex animation type that supports per-frame disposition and non-linear sprite offset selection.");
18 td.SetConstructor(&Construct);
19 td.SetSize(sizeof(ComplexAnimation));
20 td.AddSupertype(Animation::TYPE_ID, ((char *)a) - ((char *)&ca));
22 Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca));
23 td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), FrameProp::TYPE_ID).SetReferenced().SetAggregate().SetDescription("a variable number of frames"));
28 TypeDescription &ftd(TypeDescription::Create(FrameProp::TYPE_ID, "ComplexAnimationFrame"));
29 ftd.SetDescription("Information about how a frame of a complex animation should be rendered.");
30 ftd.SetSize(sizeof(FrameProp));
32 ftd.AddField("column", FieldDescription(((char *)&fp.col) - ((char *)&fp), Interpreter::NUMBER_ID).SetDescription("the column of the sprite that will be drawn"));
33 ftd.AddField("row", FieldDescription(((char *)&fp.row) - ((char *)&fp), Interpreter::NUMBER_ID).SetDescription("the row of the sprite that will be drawn"));
34 ftd.AddField("disposition", FieldDescription(((char *)&fp.disposition) - ((char *)&fp), Interpreter::VECTOR_ID).SetDescription("offset from the original drawing position"));
37 void ComplexAnimation::Construct(void *data) {
38 new (data) ComplexAnimation;