summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2Animation.h
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2Animation.h
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/T2Animation.h')
-rw-r--r--src/T2DLL/T2Animation.h52
1 files changed, 42 insertions, 10 deletions
diff --git a/src/T2DLL/T2Animation.h b/src/T2DLL/T2Animation.h
index 410a449..a7bd371 100644
--- a/src/T2DLL/T2Animation.h
+++ b/src/T2DLL/T2Animation.h
@@ -1,18 +1,50 @@
#pragma once
#include "common.h"
+#include "T2Sprite.h"
-class T2Animation {
+struct AnimationDef {
+ POINT position;
+ short pattern;
+};
+
+struct SpriteDef {
+ unsigned int resID;
+ short count;
+ short width;
+ short height;
+};
+
+class AFX_EXT_CLASS T2Animation {
public:
- void Rewind();
- int HasNextStep() const;
- int SetFrame(int);
- int GetFrame() const;
- T2Animation(T2TowerDoc*, short, short, const SpriteDef*, const AnimationDef*, T2Sprite::ELayer);
+ T2Animation(T2TowerDoc* inDoc, short inNumOfFrame, short inNumOfSprite, const SpriteDef* inSpriteDef, const AnimationDef* inAnimationDef, T2Sprite::ELayer inLayer);
~T2Animation();
- int Start(POINT, int);
- int Idle();
- void Play(POINT, int);
- int Step();
+ 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;
};