]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Animation.cpp
03bef18cf44ba321b56a551ec2d918fa3a181d07
[l2e.git] / src / graphics / Animation.cpp
1 /*
2  * Animation.cpp
3  *
4  *  Created on: Sep 5, 2012
5  *      Author: holy
6  */
7
8 #include "Animation.h"
9
10 #include "Sprite.h"
11 #include "../loader/Interpreter.h"
12 #include "../loader/TypeDescription.h"
13
14 using loader::FieldDescription;
15 using loader::Interpreter;
16 using loader::TypeDescription;
17
18 namespace graphics {
19
20 void Animation::CreateTypeDescription() {
21         TypeDescription &td(TypeDescription::Create(TYPE_ID, "Animation"));
22         td.SetDescription("Abstract base type for animations.");
23         td.SetSize(sizeof(Animation));
24 }
25
26 void Animation::AddFields(TypeDescription &td, const Animation &a, std::ptrdiff_t offset) {
27         td.AddField("sprite", FieldDescription(((char *)&a.sprite) - ((char *)&a) - offset, Sprite::TYPE_ID).SetReferenced().SetDescription("the sprite used for cutting out frames"));
28         td.AddField("frametime", FieldDescription(((char *)&a.frameTime) - ((char *)&a) - offset, Interpreter::NUMBER_ID).SetDescription("duration of a frame in miliseconds"));
29         td.AddField("repeat", FieldDescription(((char *)&a.repeat) - ((char *)&a) - offset, Interpreter::BOOLEAN_ID).SetDescription("whether the animation should start over at the beginning after reaching the last frame"));
30 }
31
32 }