]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ComplexAnimation.h
4e2cb32a0e9146bc19a5bf73149c0248f0d27b6c
[l2e.git] / src / graphics / ComplexAnimation.h
1 /*
2  * ComplexAnimation.h
3  *
4  *  Created on: Aug 12, 2012
5  *      Author: holy
6  */
7
8 #ifndef GRAPHICS_COMPLEXANIMATION_H_
9 #define GRAPHICS_COMPLEXANIMATION_H_
10
11 #include "Animation.h"
12
13 namespace graphics {
14
15 class ComplexAnimation
16 : public Animation {
17
18 public:
19         static const int TYPE_ID = 402;
20
21 public:
22         ComplexAnimation() : frames(0), numFrames(0) { }
23         ComplexAnimation(const Sprite *sprite, int frameTime, bool repeat = false)
24         : Animation(sprite, frameTime, repeat), frames(0), numFrames(0) { }
25
26 public:
27         struct FrameProp {
28                 static const int TYPE_ID = 403;
29                 FrameProp() : col(0), row(0) { }
30                 FrameProp(int col, int row, const geometry::Vector<int> &disposition)
31                 : col(col), row(row), disposition(disposition) {}
32                 int col;
33                 int row;
34                 geometry::Vector<int> disposition;
35         };
36         void SetFrames(const FrameProp *f, int num) { frames = f; numFrames = num; }
37
38         static void CreateTypeDescription();
39         static void Construct(void *);
40
41 protected:
42         virtual int NumFrames() const { return numFrames; };
43         virtual int Col(int frame) const { return frames[frame].col; }
44         virtual int Row(int frame) const { return frames[frame].row; }
45         virtual geometry::Vector<int> Offset(int frame) const { return frames[frame].disposition; }
46
47 private:
48         const FrameProp *frames;
49         int numFrames;
50
51 };
52
53 }
54
55 #endif /* GRAPHICS_COMPLEXANIMATION_H_ */