#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_EXT_CLASS T2Animation { 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; };