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