Playback.hpp
Go to the documentation of this file.
1 //
3 // Thor C++ Library
4 // Copyright (c) 2011-2016 Jan Haller
5 //
6 // This software is provided 'as-is', without any express or implied
7 // warranty. In no event will the authors be held liable for any damages
8 // arising from the use of this software.
9 //
10 // Permission is granted to anyone to use this software for any purpose,
11 // including commercial applications, and to alter it and redistribute it
12 // freely, subject to the following restrictions:
13 //
14 // 1. The origin of this software must not be misrepresented; you must not
15 // claim that you wrote the original software. If you use this software
16 // in a product, an acknowledgment in the product documentation would be
17 // appreciated but is not required.
18 //
19 // 2. Altered source versions must be plainly marked as such, and must not be
20 // misrepresented as being the original software.
21 //
22 // 3. This notice may not be removed or altered from any source distribution.
23 //
25 
28 
29 #ifndef THOR_PLAYBACK_HPP
30 #define THOR_PLAYBACK_HPP
31 
32 #include <Thor/Config.hpp>
33 #include <Thor/Animations/Detail/PlaybackSchemes.hpp>
34 
35 #include <cassert>
36 
37 
38 namespace thor
39 {
40 
43 
47 namespace Playback
48 {
49 
54  template <typename Id>
55  AURORA_IMPL_DEF(typename detail::DecayedScheme<detail::RepeatScheme, Id>::Type) repeat(Id id, std::size_t times)
56  {
57  assert(times > 0u);
58  return detail::DecayedScheme<detail::RepeatScheme, Id>::Type(std::move(id), times);
59  }
60 
64  template <typename Id>
65  AURORA_IMPL_DEF(typename detail::DecayedScheme<detail::LoopScheme, Id>::Type) loop(Id id)
66  {
67  return detail::DecayedScheme<detail::LoopScheme, Id>(std::move(id));
68  }
69 
73  inline AURORA_IMPL_DEF(detail::NotifyScheme) notify(std::function<void()> callback)
74  {
75  return detail::NotifyScheme(std::move(callback));
76  }
77 
78 } // namespace Playback
79 
81 
82 } // namespace thor
83 
84 #endif // THOR_PLAYBACK_HPP
ImplementationDefined loop(Id id)
Repeat animation an infinite number of times.
Definition: Playback.hpp:65
Definition: AnimationMap.hpp:42
Configuration header of the library.
ImplementationDefined notify(std::function< void()> callback)
Register a callback function in the queue.
Definition: Playback.hpp:73
ImplementationDefined repeat(Id id, std::size_t times)
Repeat animation a finite number of times.
Definition: Playback.hpp:55