X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FComplexAnimation.h;h=4e2cb32a0e9146bc19a5bf73149c0248f0d27b6c;hb=350055a7ff27c74882aff8a4d6af2014782f830b;hp=2eeea943b6103740c3114f71b835b14c11953408;hpb=843c216fec572902bfae1fce95671b0d17aef946;p=l2e.git diff --git a/src/graphics/ComplexAnimation.h b/src/graphics/ComplexAnimation.h index 2eeea94..4e2cb32 100644 --- a/src/graphics/ComplexAnimation.h +++ b/src/graphics/ComplexAnimation.h @@ -10,43 +10,43 @@ #include "Animation.h" -#include - namespace graphics { class ComplexAnimation : public Animation { public: - ComplexAnimation() { } - ComplexAnimation(const Sprite *sprite, int frameTime, bool repeat = false) - : Animation(sprite, frameTime, repeat) { } + static const int TYPE_ID = 402; public: - void AddFrame(int col, int row, const geometry::Vector &disposition = geometry::Vector()) { - frames.push_back(FrameProp(col, row, disposition)); - } - void AddFrames(int col, int row, const geometry::Vector &disposition, int amount) { - for (int i(0); i < amount; ++i) { - AddFrame(col, row, disposition); - } - } - -protected: - virtual int NumFrames() const { return frames.size(); }; - virtual int Col(int frame) const { return frames[frame].col; } - virtual int Row(int frame) const { return frames[frame].row; } - virtual geometry::Vector Offset(int frame) const { return frames[frame].disposition; } + ComplexAnimation() : frames(0), numFrames(0) { } + ComplexAnimation(const Sprite *sprite, int frameTime, bool repeat = false) + : Animation(sprite, frameTime, repeat), frames(0), numFrames(0) { } -private: +public: struct FrameProp { + static const int TYPE_ID = 403; + FrameProp() : col(0), row(0) { } FrameProp(int col, int row, const geometry::Vector &disposition) : col(col), row(row), disposition(disposition) {} int col; int row; geometry::Vector disposition; }; - std::vector frames; + void SetFrames(const FrameProp *f, int num) { frames = f; numFrames = num; } + + static void CreateTypeDescription(); + static void Construct(void *); + +protected: + virtual int NumFrames() const { return numFrames; }; + virtual int Col(int frame) const { return frames[frame].col; } + virtual int Row(int frame) const { return frames[frame].row; } + virtual geometry::Vector Offset(int frame) const { return frames[frame].disposition; } + +private: + const FrameProp *frames; + int numFrames; };