+ return timer.Running() && (animation->Repeat() || timer.Iteration() < animation->NumFrames());
+ }
+ bool Finished() const {
+ return Started() && !Running();
+ }
+ bool JustFinished() const {
+ return timer.JustHit() && timer.Iteration() == animation->NumFrames();
+ }
+
+ const app::Timer<Uint32> &GetTimer() { return timer; }
+
+ void SetColOffset(int offset) { colOffset = offset; }
+ int ColOffset() const { return colOffset; }
+ void SetRowOffset(int offset) { rowOffset = offset; }
+ int RowOffset() const { return rowOffset; }
+
+ void ChangeAnimation(const Animation *a) { animation = a; }
+ const Animation *GetAnimation() const { return animation; }
+
+ void ChangeSprite(const Sprite *s) { sprite = s; }
+ const Sprite *GetSprite() const { return sprite ? sprite : animation->GetSprite(); }
+
+ void Draw(SDL_Surface *dest, geometry::Vector<int> position) const {
+ GetSprite()->Draw(dest, position + animation->Offset(Frame()), animation->Col(Frame()) + ColOffset(), animation->Row(Frame()) + RowOffset());
+ }
+ void DrawTopRight(SDL_Surface *dest, geometry::Vector<int> position) const {
+ geometry::Vector<int> offset(-GetSprite()->Width(), 0);
+ Draw(dest, position + offset);