summaryrefslogtreecommitdiff
path: root/src/simpleanimation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/simpleanimation.cpp')
-rw-r--r--src/simpleanimation.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 65d8e8e2..7038f446 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -129,6 +129,16 @@ void SimpleAnimation::reset()
mAnimationPhase = 0;
}
+void SimpleAnimation::setFrame(int frame)
+{
+ if (frame < 0)
+ frame = 0;
+ if (frame >= mAnimation->getLength())
+ frame = mAnimation->getLength() - 1;
+ mAnimationPhase = frame;
+ mCurrentFrame = mAnimation->getFrame(mAnimationPhase);
+}
+
void SimpleAnimation::update(unsigned int timePassed)
{
mAnimationTime += timePassed;
@@ -145,6 +155,11 @@ void SimpleAnimation::update(unsigned int timePassed)
}
}
+int SimpleAnimation::getLength()
+{
+ return mAnimation->getLength();
+}
+
Image *SimpleAnimation::getCurrentImage() const
{
return mCurrentFrame->image;