#pragma once #include "common.h" #include "T2Sprite.h" struct AnimationDef { POINT position; short pattern; }; struct SpriteDef { unsigned int resID; short count; short width; short height; }; class AFX_CLASS_EXPORT T2Animation { private: void operator=(const T2Animation &); // no assignment public: T2Animation(T2TowerDoc* inDoc, short inNumOfFrame, short inNumOfSprite, const SpriteDef* inSpriteDef, const AnimationDef* inAnimationDef, T2Sprite::ELayer inLayer); ~T2Animation(); BOOL Start(POINT inPt, int inLen); BOOL Idle(); void Play(POINT inPt, int inLen); BOOL Step(); void Rewind() { SetFrame(0); } BOOL HasNextStep() const { return (mFrame >= 0) && (mFrame < mNumOfFrame); } BOOL SetFrame(int inFrame) { mFrame = inFrame; return HasNextStep(); } int GetFrame() const { return mFrame; } protected: void Draw(); T2TowerDoc *mDocument; short mNumOfFrame; short mNumOfSprite; const AnimationDef *mAnimationDef; int *mSpriteIndices; T2ImageObj **mImageObjs; T2BitImage **mImages; POINT mPoint; short mFrame; int mInterval; DWORD mTickCount; };