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