#ifndef ANIMATION_H_332518EB #define ANIMATION_H_332518EB #include #include #include #include #include #include "direction.h" #include "timer.h" class Animation { public: explicit Animation(std::string_view path); void setDirection(Direction dir); void setAnimation(std::string_view anim); const SDL_Rect& getRenderRect() const { return frames_.at(animations_.at(animationId_).at(animationFrame_)); } void update(int dt); private: void updateAnim(); std::vector frames_; std::vector> animations_; std::map> nameDirToAnim_; Direction dir_ = Direction::down; std::string animationName_ = "still"; int animationId_ = 0; int animationFrame_ = 0; Timer animTimer_ = {1000/5}; }; #endif /* end of include guard: ANIMATION_H_332518EB */