+
+void AnimationRunner::Draw(SDL_Surface *dest, math::Vector<int> position) const {
+ GetSprite()->Draw(dest,
+ position + animation->Offset(Frame()),
+ animation->Col(Frame()) + ColOffset(),
+ animation->Row(Frame()) + RowOffset());
+}
+
+void AnimationRunner::DrawTopRight(SDL_Surface *dest, math::Vector<int> position) const {
+ math::Vector<int> offset(-GetSprite()->Width(), 0);
+ Draw(dest, position + offset);
+}
+
+void AnimationRunner::DrawCenter(SDL_Surface *dest, math::Vector<int> position) const {
+ Draw(dest, position - (GetSprite()->Size() / 2));
+}
+
+void AnimationRunner::DrawCenterBottom(SDL_Surface *dest, math::Vector<int> position) const {
+ math::Vector<int> offset(-GetSprite()->Width() / 2, -GetSprite()->Height());
+ Draw(dest, position + offset);
+}
+
+int AnimationRunner::Frame() const {
+ return Running()
+ ? ((timer.Iteration() + frameShift) % animation->NumFrames())
+ : 0;
+}
+
+