UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
animation.h
Go to the documentation of this file.
1 #ifndef UGDK_ACTION_ANIMATION_H_
2 #define UGDK_ACTION_ANIMATION_H_
3 
6 
7 #include <string>
8 #include <vector>
9 #include <functional>
10 
11 namespace ugdk {
12 namespace action {
13 
14 template<class Frame>
15 class Animation {
16  public:
17  using value_type = Frame;
18  using Vector = std::vector<std::unique_ptr<Frame>>;
19 
20  enum class AnimationRepeat {
21  LOOP, NONE
22  };
23 
24  template <class ...Args>
25  Animation(Args... args)
26  : frames_(std::forward(args)...)
27  , repeat_(AnimationRepeat::LOOP)
28  {}
30 
31  Vector& frames() { return frames_; }
32  const Vector& frames() const { return frames_; }
33 
34  AnimationRepeat repeat() const { return repeat_; }
35  void set_repeat(AnimationRepeat repeat) { repeat_ = repeat; }
36 
37  private:
38  Vector frames_;
39  AnimationRepeat repeat_;
40 };
41 
42 } /* namespace action */
43 } /* namespace ugdk */
44 
45 #endif /* UGDK_ACTION_ANIMATION_H_ */
46 
47 
Frame value_type
Definition: animation.h:17
const Vector & frames() const
Definition: animation.h:32
std::vector< std::unique_ptr< Frame >> Vector
Definition: animation.h:18
STL namespace.
Definition: animation.h:11
Vector & frames()
Definition: animation.h:31
void set_repeat(AnimationRepeat repeat)
Definition: animation.h:35
~Animation()
Definition: animation.h:29
Animation(Args...args)
Definition: animation.h:25
Definition: animation.h:15
AnimationRepeat repeat() const
Definition: animation.h:34
AnimationRepeat
Definition: animation.h:20