Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/CSpriteAnimation.h
blob: 5154e347e7f5a50f94cbd6857d867183c874d446 (plain)
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
//--------------------------------------------------------------------------------------------------
// CSpriteAnimation.
// Clase que representa una animación hecha con frames. Un sprite va a tener varias una referencia a
// CSpriteAnimation para cada una de las animaciones que tenga (caminar, saltar, disparar, etc).
//--------------------------------------------------------------------------------------------------

#ifndef __CSPRITEANIMATION_H__
#define __CSPRITEANIMATION_H__

#include "CSpriteFrame.h"
#include <vector>

class CSpriteAnimation
{
	public:
		CSpriteAnimation(void);
		CSpriteAnimation(const char *aFile, int aFrames, int aRows, int aColumns, int aFrameWidth, int aFrameHeight, bool aFlippableH, bool aFlippableV);
		~CSpriteAnimation(void);
		void destroy(void);

		int getWidth(void);
		int getHeight(void);
		int getNumFrames(void);
		bool isBuilt(void);

		CSpriteFrame *getFrame(int aFrameIndex);

	private:
		// Array with the animation frames.
		std::vector<CSpriteFrame *> mFrame;

		// Number of frames in the animation.
		int mNumFrames;

		// Width and height del frame (todos los frames tienen el mismo ancho y alto).
		int mWidth;
		int mHeight;

		bool mBuilt;

		bool mFlippableH;
		bool mFlippableV;

		int mStartFrameFlipH;
		int mStartFrameFlipV;
		int mStartFrameFlipHV;
};

#endif /* __CSPRITEANIMATION_H__ */