]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ComplexAnimation.cpp
removed stupid file headers that eclipse put in
[l2e.git] / src / graphics / ComplexAnimation.cpp
1 #include "ComplexAnimation.h"
2
3 #include "../loader/Interpreter.h"
4 #include "../loader/TypeDescription.h"
5
6 using loader::FieldDescription;
7 using loader::Interpreter;
8 using loader::TypeDescription;
9
10 namespace graphics {
11
12 void ComplexAnimation::CreateTypeDescription() {
13         ComplexAnimation ca;
14         Animation *a(&ca);
15
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));
21
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"));
24
25
26         FrameProp fp;
27
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));
31
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"));
35 }
36
37 void ComplexAnimation::Construct(void *data) {
38         new (data) ComplexAnimation;
39 }
40
41 }