]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ComplexAnimation.cpp
removed type resolution from Animation::addFields
[l2e.git] / src / graphics / ComplexAnimation.cpp
1 /*
2  * ComplexAnimation.cpp
3  *
4  *  Created on: Sep 5, 2012
5  *      Author: holy
6  */
7
8 #include "ComplexAnimation.h"
9
10 #include "../loader/TypeDescription.h"
11
12 using loader::FieldDescription;
13 using loader::TypeDescription;
14
15 namespace graphics {
16
17 void ComplexAnimation::CreateTypeDescription() {
18         ComplexAnimation ca;
19         Animation *a(&ca);
20
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
27         TypeDescription &td(TypeDescription::CreateOrGet("ComplexAnimation"));
28         td.SetSize(sizeof(ComplexAnimation));
29         td.AddSupertype(animationId, ((char *)a) - ((char *)&ca));
30
31         Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca), boolId, numberId, spriteId);
32         td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), frameId, true, true));
33
34
35         FrameProp fp;
36
37         int numberId(TypeDescription::GetTypeId("Number"));
38         int vectorId(TypeDescription::GetTypeId("Vector"));
39
40         TypeDescription &ftd(TypeDescription::CreateOrGet("ComplexAnimationFrame"));
41         ftd.SetSize(sizeof(FrameProp));
42
43         ftd.AddField("column", FieldDescription(((char *)&fp.col) - ((char *)&fp), numberId, false));
44         ftd.AddField("row", FieldDescription(((char *)&fp.row) - ((char *)&fp), numberId, false));
45         ftd.AddField("disposition", FieldDescription(((char *)&fp.disposition) - ((char *)&fp), vectorId, false));
46 }
47
48 }