summary refs log tree commit diff stats
path: root/src/components/animatable.h
blob: ed0133edd31ad6661e6da4fa0464289fb0f90e2d (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
#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);
  }

private:

  AnimationSet animationSet_;
  std::string animation_;
  size_t frame_ = 0;
  size_t countdown_ = 0;
};

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