Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/CSpriteAnimation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/CSpriteAnimation.h')
-rwxr-xr-xsrc/CSpriteAnimation.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/CSpriteAnimation.h b/src/CSpriteAnimation.h
new file mode 100755
index 0000000..5154e34
--- /dev/null
+++ b/src/CSpriteAnimation.h
@@ -0,0 +1,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__ */