]> git.localhorst.tv Git - l2e.git/blob - src/graphics/SimpleAnimation.h
8374f0825363d3b80b05fe222cdfbd4db36ff61c
[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         SimpleAnimation()
20         : numFrames(0), col(0), row(0) { }
21         SimpleAnimation(const Sprite *sprite, int frameTime, int numFrames, int col = 0, int row = 0, bool repeat = false)
22         : Animation(sprite, frameTime, repeat), numFrames(numFrames), col(col), row(row) { }
23
24 public:
25         void SetNumFrames(int n) { numFrames = n; }
26         void SetCol(int c) { col = c; }
27         void SetRow(int r) { row = r; }
28
29         static void CreateTypeDescription();
30         static void Construct(void *);
31
32 protected:
33         virtual int NumFrames() const { return numFrames; };
34         virtual int Col(int frame) const { return col; }
35         virtual int Row(int frame) const { return row + frame; }
36
37 private:
38         int numFrames;
39         int col;
40         int row;
41
42 };
43
44 }
45
46 #endif /* GRAPHICS_SIMPLEANIMATION_H_ */