summary refs log tree commit diff stats
path: root/src/components/animatable.h
blob: ec72be04b77068d419ba38a023a2a89991b0b4dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef SPRITE_RENDERABLE_H_D3AACBBF
#define SPRITE_RENDERABLE_H_D3AACBBF

#include "component.h"
#include "animation.h"
#include <string>

class AnimatableComponent : public Component {
public:

  AnimatableComponent(
    AnimationSet animationSet,
    std::string animation) :
      animationSet_(std::move(animationSet)),
      animation_(std::move(animation))
  {
  }

  inline size_t getFrame() const
  {
    return frame_;
  }

  inline void setFrame(size_t v)
  {
    frame_ = v;
  }

  inline size_t getCountdown() const
  {
    return countdown_;
  }

  inline void setCountdown(size_t v)
  {
    countdown_ = v;
  }

  inline const AnimationSet& getAnimationSet() const
  {
    return animationSet_;
  }

  inline const Animation& getAnimation() const
  {
    return animationSet_.getAnimation(animation_);
  }

  inline void setAnimation(std::string animation)
  {
    animation_ = std::move(animation);
  }

  inline bool isFlickering() const
  {
    return flickering_;
  }

  inline void setFlickering(bool v)
  {
    flickering_ = v;
  }

  inline size_t getFlickerTimer() const
  {
    return flickerTimer_;
  }

  inline void setFlickerTimer(size_t v)
  {
    flickerTimer_ = v;
  }

  inline bool isFrozen() const
  {
    return frozen_;
  }

  inline void setFrozen(bool v)
  {
    frozen_ = v;
  }

private:

  AnimationSet animationSet_;
  std::string animation_;
  size_t frame_ = 0;
  size_t countdown_ = 0;
  bool flickering_ = false;
  size_t flickerTimer_ = 0;
  bool frozen_ = false;
};

#endif /* end of include guard: SPRITE_RENDERABLE_H_D3AACBBF */