diff options
Diffstat (limited to 'src/animation_system.h')
-rw-r--r-- | src/animation_system.h | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ | |||
1 | #ifndef ANIMATION_SYSTEM_H_CCCC7CB8 | ||
2 | #define ANIMATION_SYSTEM_H_CCCC7CB8 | ||
3 | |||
4 | #include <string_view> | ||
5 | #include "direction.h" | ||
6 | #include "system.h" | ||
7 | #include "timer.h" | ||
8 | |||
9 | class Game; | ||
10 | class Renderer; | ||
11 | |||
12 | class AnimationSystem : public System { | ||
13 | public: | ||
14 | |||
15 | static constexpr SystemKey Key = SystemKey::Animation; | ||
16 | |||
17 | AnimationSystem(Game& game) : game_(game) {} | ||
18 | |||
19 | void tick(double dt) override; | ||
20 | |||
21 | void initSprite(int spriteId, std::string_view filename, Renderer& renderer); | ||
22 | |||
23 | void setSpriteDirection(int spriteId, Direction dir); | ||
24 | |||
25 | void setSpriteAnimation(int spriteId, std::string_view name); | ||
26 | |||
27 | private: | ||
28 | |||
29 | void updateAnimation(int spriteId); | ||
30 | |||
31 | Game& game_; | ||
32 | Timer animTimer_ {1000/5};//30fps * 1000 t/s;; | ||
33 | }; | ||
34 | |||
35 | #endif /* end of include guard: ANIMATION_SYSTEM_H_CCCC7CB8 */ | ||