4 * Created on: Sep 5, 2012
8 #include "ComplexAnimation.h"
10 #include "../loader/TypeDescription.h"
12 using loader::FieldDescription;
13 using loader::TypeDescription;
17 void ComplexAnimation::CreateTypeDescription() {
21 int animationId(TypeDescription::GetTypeId("Animation"));
22 int boolId(TypeDescription::GetTypeId("Boolean"));
23 int frameId(TypeDescription::GetTypeId("ComplexAnimationFrame"));
24 int numberId(TypeDescription::GetTypeId("Number"));
25 int spriteId(TypeDescription::GetTypeId("Sprite"));
26 int vectorId(TypeDescription::GetTypeId("Vector"));
28 TypeDescription &td(TypeDescription::CreateOrGet("ComplexAnimation"));
29 td.SetDescription("Complex animation type that supports per-frame disposition and non-linear sprite offset selection.");
30 td.SetConstructor(&Construct);
31 td.SetSize(sizeof(ComplexAnimation));
32 td.AddSupertype(animationId, ((char *)a) - ((char *)&ca));
34 Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca), boolId, numberId, spriteId);
35 td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), frameId).SetReferenced().SetAggregate().SetDescription("a variable number of frames"));
40 TypeDescription &ftd(TypeDescription::CreateOrGet("ComplexAnimationFrame"));
41 ftd.SetDescription("Information about how a frame of a complex animation should be rendered.");
42 ftd.SetSize(sizeof(FrameProp));
44 ftd.AddField("column", FieldDescription(((char *)&fp.col) - ((char *)&fp), numberId).SetDescription("the column of the sprite that will be drawn"));
45 ftd.AddField("row", FieldDescription(((char *)&fp.row) - ((char *)&fp), numberId).SetDescription("the row of the sprite that will be drawn"));
46 ftd.AddField("disposition", FieldDescription(((char *)&fp.disposition) - ((char *)&fp), vectorId).SetDescription("offset from the original drawing position"));
49 void ComplexAnimation::Construct(void *data) {
50 new (data) ComplexAnimation;