]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ComplexAnimation.h
added type description of complex animation
[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
36 protected:
37         virtual int NumFrames() const { return numFrames; };
38         virtual int Col(int frame) const { return frames[frame].col; }
39         virtual int Row(int frame) const { return frames[frame].row; }
40         virtual geometry::Vector<int> Offset(int frame) const { return frames[frame].disposition; }
41
42 private:
43         const FrameProp *frames;
44         int numFrames;
45
46 };
47
48 }
49
50 #endif /* GRAPHICS_COMPLEXANIMATION_H_ */