]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ComplexAnimation.h
new language, new compiler
[l2e.git] / src / graphics / ComplexAnimation.h
1 #ifndef GRAPHICS_COMPLEXANIMATION_H_
2 #define GRAPHICS_COMPLEXANIMATION_H_
3
4 #include "Animation.h"
5 #include "../loader/noinit.h"
6
7 namespace graphics {
8
9 class ComplexAnimation
10 : public Animation {
11
12 public:
13         static const int TYPE_ID = 402;
14
15 public:
16         ComplexAnimation();
17         ComplexAnimation(const Sprite *sprite, int frameTime, bool repeat = false);
18 protected:
19         ComplexAnimation(loader::noinit_t);
20
21 public:
22         struct FrameProp {
23                 static const int TYPE_ID = 403;
24                 FrameProp() : col(0), row(0) { }
25                 FrameProp(int col, int row, const math::Vector<int> &disposition)
26                 : col(col), row(row), disposition(disposition) {}
27                 int col;
28                 int row;
29                 math::Vector<int> disposition;
30         };
31         void SetFrames(const FrameProp *f, int num) { frames = f; numFrames = num; }
32
33         static void CreateTypeDescription();
34         static void Construct(void *);
35         static void Initialize(void *);
36
37 protected:
38         virtual int NumFrames() const;
39         virtual int Col(int frame) const;
40         virtual int Row(int frame) const;
41         virtual math::Vector<int> Offset(int frame) const;
42
43 private:
44         const FrameProp *frames;
45         int numFrames;
46
47 };
48
49 }
50
51 #endif