]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ComplexAnimation.h
e35895d9ae5f59c5f03c01cbb20ae0a3a0e6cb00
[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         ComplexAnimation() : frames(0), numFrames(0) { }
20         ComplexAnimation(const Sprite *sprite, int frameTime, bool repeat = false)
21         : Animation(sprite, frameTime, repeat), frames(0), numFrames(0) { }
22
23 public:
24         struct FrameProp {
25                 FrameProp() : col(0), row(0) { }
26                 FrameProp(int col, int row, const geometry::Vector<int> &disposition)
27                 : col(col), row(row), disposition(disposition) {}
28                 int col;
29                 int row;
30                 geometry::Vector<int> disposition;
31         };
32         void SetFrames(const FrameProp *f, int num) { frames = f; numFrames = num; }
33
34         static void CreateTypeDescription();
35         static void Construct(void *);
36
37 protected:
38         virtual int NumFrames() const { return numFrames; };
39         virtual int Col(int frame) const { return frames[frame].col; }
40         virtual int Row(int frame) const { return frames[frame].row; }
41         virtual geometry::Vector<int> Offset(int frame) const { return frames[frame].disposition; }
42
43 private:
44         const FrameProp *frames;
45         int numFrames;
46
47 };
48
49 }
50
51 #endif /* GRAPHICS_COMPLEXANIMATION_H_ */