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
/********************************************************************
*
*	Created:	13/3/2014   16:55
*
*	File:		fsCAnimationDataPlayfirst.h
*
*	Author:		Mick Waites
*	
*	Purpose:	Shared data from which AnimatingSprites are created.
*
*********************************************************************/

#ifndef fsCAnimationDataPlayfirsthdr
#define fsCAnimationDataPlayfirsthdr

#include <vector>

#include <fsCore/src/xml/fsIXmlNode.h>
#include <fsCore/fsAffineMtx2d.h>

#include "../../fsIAnimationData.h"

class fsCResourceName;
class fsCSpriteFrame;
class fsCAnimationTimeline;
class fsCBrush;


class fsCAnimationDataPlayfirst : public fsIAnimationData
{
	friend class fsCAnimationDataManager;
	friend class fsCAnimatingSpritePlayfirst;
	friend class fsCSpriteFrame;

public:

	fsS32 blendModeGet() const;

	virtual ~fsCAnimationDataPlayfirst();<--- Destructor in derived class

protected:

	struct sSpriteFrameInfo
	{
		sSpriteFrameInfo() : mAlpha(0.0f)
		{
		}

		sSpriteFrameInfo(std::shared_ptr<fsCBrush> pBrush, fsF32 pAlpha, const fsAffineMtx2d& pMtx) :
			mBrush(pBrush),
			mAlpha(pAlpha),
			mMtx(pMtx)
		{
		}

		std::shared_ptr<fsCBrush> mBrush;
		fsF32 mAlpha;
		fsAffineMtx2d mMtx;
	};

	fsCAnimationDataPlayfirst();

	void initialiseDo(const fsCResourceName& pFileName, fsBool pHitMap) override;

	void framesParse(fsIXmlNode::_iterRef pParent);
	void timelineParse(fsIXmlNode::_iterRef pParent);

	std::vector<std::shared_ptr<sSpriteFrameInfo>> mSpriteFramesInfo;
	std::vector<std::shared_ptr<fsCAnimationTimeline>> mTimelines;

	std::shared_ptr<fsCBrush> mAnimBrush;

	fsBool mLooping;

	fsS32 mBlendMode;

private:
};

#endif