1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144 | /********************************************************************
*
* File: fsIAnimatingSprite.h
*
* Purpose: Interface for animating sprites
*
*********************************************************************/
#ifndef fsIAnimatingSpritehdr
#define fsIAnimatingSpritehdr
#include <memory>
#include <fsCore/fsBaseTypes.h>
#include "fsAnimationEvent.h"
#include "fsIRenderable.h"
#include "src/animatingSprite/fsCAnimationDataManager.h"
class fsCResourceName;
class fsAffineMtx2d;
class fsStr;
class fsIAnimationData;
class fsCAnimationTimeline;
class fsCSpriteFrame;
struct fsPoint;
class fsSColour;
class fsCSprite;
class fsCBrush;
class fsIAnimatingSprite : public fsIRenderable
{
friend std::shared_ptr<fsIAnimatingSprite> const fsCAnimationDataManager::createAnimationInstance(
std::shared_ptr<fsIAnimationData>, fsCSprite* pAnimatingRootSprt);
public:
void animationPlay(const fsStr& pAnimation);
void animationPlay(const fsStr& pAnimation, fsBool pLooping);
fsBool animationQueue(const fsStr& pAnimation, fsBool pLooping);
fsBool animationTrackPlay(fsS32 pTrackIndex, const fsStr& pAnimation, fsBool pLooping);
fsBool animationTrackQueue(fsS32 pTrackIndex, const fsStr& pAnimation, fsBool pLooping);
fsBool animationTrackClear(fsS32 pTrackIndex);
void animationTracksClear();
void animationMixDurationSet(fsS32 pDurationMs);
fsBool skinSet(const fsStr& pSkin);
fsBool attachmentSet(const fsStr& pSlot, const fsStr& pAttachment);
void animationEventCallbackSet(fsTAnimationEventCallback pCallback);
fsS32 currentFrameHeightGet() const;
fsPoint currentFramePosGet() const;
void stop();
std::shared_ptr<fsCBrush> brushGet() const;
fsBool hitTest(const fsPoint& pPoint, fsBool pRequireHitMap) const;
// fsBool pixelCollisionCheck( fsISpriteRef pTarget );
fsS32 currentFrameGet() const;
void update(fsS32 pDeltaMS);
fsBool animatingGet() const;
fsBool loopingGet() const;
void reset();
fsIAnimatingSprite(const fsCResourceName& pFileName, fsBool pHitMap, fsCSprite* pAnimatingSpriteRoot);
fsIAnimatingSprite(fsCSprite* pAnimatingRootSprt);
virtual ~fsIAnimatingSprite();<--- Destructor in derived class
protected:
void animationDataSet(std::shared_ptr<fsIAnimationData> pAnimData);
void animationEventDispatch(const fsSAnimationEvent& pEvent) const;
void colourSetDo(const fsSColour4B& pColour) override;
virtual void animationPlayDo(const fsStr& pAnimation)
{
};
// Providers whose runtimes choose looping at playback time can override this
// overload. Existing providers retain their authored looping behaviour.
virtual void animationPlayDo(const fsStr& pAnimation, fsBool)
{
animationPlayDo(pAnimation);
};
virtual fsBool animationQueueDo(const fsStr&, fsBool)
{
return false;
}
virtual fsBool animationTrackPlayDo(fsS32, const fsStr&, fsBool)
{
return false;
}
virtual fsBool animationTrackQueueDo(fsS32, const fsStr&, fsBool)
{
return false;
}
virtual fsBool animationTrackClearDo(fsS32)
{
return false;
}
virtual void animationTracksClearDo()
{
}
virtual void animationMixDurationSetDo(fsS32)
{
}
virtual fsBool skinSetDo(const fsStr&)
{
return false;
}
virtual fsBool attachmentSetDo(const fsStr&, const fsStr&)
{
return false;
}
virtual void activeSet(fsBool pVisibility) = 0;
virtual void colourApplyToSpriteFrames(const fsSColour4B& pColour) = 0;
virtual void animationDataSetDo(std::shared_ptr<fsIAnimationData> pAnimData) = 0;
virtual fsS32 currentFrameHeightGetDo() const = 0;
virtual fsPoint currentFramePosGetDo() const = 0;
virtual std::shared_ptr<fsCBrush> brushGetDo() const;
virtual fsBool hitTestDo(const fsPoint& pPoint, fsBool pRequireHitMap) const = 0;
// virtual fsBool pixelCollisionCheckDo( fsISpriteRef pTarget ) = 0;
virtual fsS32 currentFrameGetDo() const = 0;
virtual void updateDo(fsS32 pDeltaMS) = 0;
virtual fsBool loopingGetDo() const = 0;
virtual void resetDo() = 0;
fsBool mActive;
fsCSprite* mAnimationRootSprt;
private:
fsTAnimationEventCallback mAnimationEventCallback;
};
#endif
|