From be09120d1d044b476ef8b516efbdb526f20d9e2d Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 3 Feb 2021 01:35:58 -0500 Subject: Added animation system --- src/animation_system.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/animation_system.h (limited to 'src/animation_system.h') diff --git a/src/animation_system.h b/src/animation_system.h new file mode 100644 index 0000000..2e13784 --- /dev/null +++ b/src/animation_system.h @@ -0,0 +1,35 @@ +#ifndef ANIMATION_SYSTEM_H_CCCC7CB8 +#define ANIMATION_SYSTEM_H_CCCC7CB8 + +#include +#include "direction.h" +#include "system.h" +#include "timer.h" + +class Game; +class Renderer; + +class AnimationSystem : public System { +public: + + static constexpr SystemKey Key = SystemKey::Animation; + + AnimationSystem(Game& game) : game_(game) {} + + void tick(double dt) override; + + void initSprite(int spriteId, std::string_view filename, Renderer& renderer); + + void setSpriteDirection(int spriteId, Direction dir); + + void setSpriteAnimation(int spriteId, std::string_view name); + +private: + + void updateAnimation(int spriteId); + + Game& game_; + Timer animTimer_ {1000/5};//30fps * 1000 t/s;; +}; + +#endif /* end of include guard: ANIMATION_SYSTEM_H_CCCC7CB8 */ -- cgit 1.4.1