]> git.localhorst.tv Git - l2e.git/blob - src/graphics/SimpleAnimation.h
d5d758fc7c3a88978a47aa2f0e898335a99a6b7c
[l2e.git] / src / graphics / SimpleAnimation.h
1 /*
2  *  SimpleAnimation.h
3  *
4  *  Created on: Aug 11, 2012
5  *      Author: holy
6  */
7
8 #ifndef GRAPHICS_SIMPLEANIMATION_H_
9 #define GRAPHICS_SIMPLEANIMATION_H_
10
11 #include "Animation.h"
12
13 namespace graphics {
14
15 class SimpleAnimation
16 : public Animation {
17
18 public:
19         static const int TYPE_ID = 408;
20
21 public:
22         SimpleAnimation()
23         : numFrames(0), col(0), row(0) { }
24         SimpleAnimation(const Sprite *sprite, int frameTime, int numFrames, int col = 0, int row = 0, bool repeat = false)
25         : Animation(sprite, frameTime, repeat), numFrames(numFrames), col(col), row(row) { }
26
27 public:
28         void SetNumFrames(int n) { numFrames = n; }
29         void SetCol(int c) { col = c; }
30         void SetRow(int r) { row = r; }
31
32         static void CreateTypeDescription();
33         static void Construct(void *);
34
35 protected:
36         virtual int NumFrames() const { return numFrames; };
37         virtual int Col(int frame) const { return col; }
38         virtual int Row(int frame) const { return row + frame; }
39
40 private:
41         int numFrames;
42         int col;
43         int row;
44
45 };
46
47 }
48
49 #endif /* GRAPHICS_SIMPLEANIMATION_H_ */