4 * Created on: Aug 12, 2012
8 #ifndef GRAPHICS_COMPLEXANIMATION_H_
9 #define GRAPHICS_COMPLEXANIMATION_H_
11 #include "Animation.h"
17 class ComplexAnimation
21 ComplexAnimation() { }
22 ComplexAnimation(const Sprite *sprite, int frameTime, bool repeat = false)
23 : Animation(sprite, frameTime, repeat) { }
26 void AddFrame(int col, int row, const geometry::Vector<int> &disposition = geometry::Vector<int>()) {
27 frames.push_back(FrameProp(col, row, disposition));
29 void AddFrames(int col, int row, const geometry::Vector<int> &disposition, int amount) {
30 for (int i(0); i < amount; ++i) {
31 AddFrame(col, row, disposition);
35 virtual void Draw(SDL_Surface *dest, geometry::Point<int> position) const {
36 Animation::Draw(dest, position + frames[Frame()].disposition);
40 virtual int Col() const { return frames[Frame()].col; }
41 virtual int Row() const { return frames[Frame()].row; }
42 virtual int NumFrames() const { return frames.size(); };
46 FrameProp(int col, int row, const geometry::Vector<int> &disposition)
47 : col(col), row(row), disposition(disposition) {}
50 geometry::Vector<int> disposition;
52 std::vector<FrameProp> frames;
58 #endif /* GRAPHICS_COMPLEXANIMATION_H_ */