Browse Source

Added getCurrentAnimationFrame and isCurrentAnimationFinished to ScreenSprite from doomlaser's pull request

Ivan Safrin 12 years ago
parent
commit
9557993edf

+ 2 - 0
Core/Contents/Include/PolyScreenSprite.h

@@ -122,6 +122,8 @@ class _PolyExport ScreenSprite : public ScreenShape
 		SpriteAnimation *getAnimationAtIndex(unsigned int index);
 		
 		SpriteAnimation *getCurrentAnimation();
+		unsigned int getCurrentAnimationFrame();
+		bool isCurrentAnimationFinished();
 		
 		void updateSprite();
 		

+ 12 - 0
Core/Contents/Source/PolyScreenSprite.cpp

@@ -174,6 +174,18 @@ SpriteAnimation *ScreenSprite::getCurrentAnimation() {
 	return currentAnimation;
 }
 
+unsigned int ScreenSprite::getCurrentAnimationFrame() { 
+   return currentFrame; 
+}
+
+bool ScreenSprite::isCurrentAnimationFinished() {
+    if(currentAnimation) {
+        if(currentFrame >= currentAnimation->numFrames)
+            return true;
+    }
+    return false;
+}
+
 void SpriteAnimation::setOffsetsFromFrameString(const String& frames) {
 	framesOffsets.clear();
 	vector<String> frameNumbers = frames.split(",");