You.i Engine
YiAbstractTimeline.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ABSTRACT_TIMELINE_H_
3 #define _YI_ABSTRACT_TIMELINE_H_
4 
6 #include "signal/YiSignal.h"
8 #include "utility/YiRtti.h"
9 
10 #include <glm/fwd.hpp>
11 
12 class CYIAbstractTimelinePriv;
13 class CYISceneNode;
14 class CYISceneNodeProxy;
15 
30 {
31  friend class CYITimelineGroup;
32  friend class CYISerialTimelineGroup;
34  friend class CYITimelineLoop;
35 
36 public:
40  enum class FrameMode : uint8_t
41  {
45  Absolute,
49  Relative
50  };
51 
55  enum class Status : uint8_t
56  {
57  Stopped,
58  Playing,
59  };
60 
64  enum class Direction : uint8_t
65  {
66  Forward,
67  Reverse,
68  };
69 
70  virtual ~CYIAbstractTimeline();
71 
76  void Start();
77 
82  void Finish();
83 
88  void Pause();
89 
94  void Continue();
95 
100  void SetDirection(Direction direction);
101 
105  Direction GetDirection() const;
106 
110  Status GetStatus() const;
111 
115  uint64_t GetStartTime() const;
116 
120  uint64_t GetCurrentTime() const;
121 
125  float GetTimeAsPercentage() const;
126 
130  uint64_t GetTotalTime() const;
131 
137  void SeekToPercentage(float percentage);
138 
144  void SeekToTime(uint64_t millis);
145 
150  void Abort();
151 
155  void SetDisablesInput(bool disablesInput);
156 
166  void Track();
167 
168  void Untrack();
169 
175  void StartForward();
176 
182  void StartReverse();
183 
189  void ContinueForward();
190 
196  void ContinueReverse();
197 
202  void SetDirectionForward();
203 
208  void SetDirectionReverse();
209 
220  void SetFrameModes(FrameMode startFrameMode, FrameMode endFrameMode);
221 
233  bool SetSourcePositions(CYISceneNode *pNode, const glm::vec3 &position);
234 
244  bool ClearSourcePositions(CYISceneNode *pNode);
245 
257  bool SetTargetPositions(CYISceneNode *pNode, const glm::vec3 &position);
258 
268  bool ClearTargetPositions(CYISceneNode *pNode);
269 
277  bool SetSourceScales(CYISceneNode *pNode, const glm::vec3 &scale);
278 
288  bool ClearSourceScales(CYISceneNode *pNode);
289 
293  void SetLooping(bool isLooping);
294 
298  bool GetLooping() const;
299 
304  const std::shared_ptr<CYITimelineProxy> &GetProxy() const;
305 
313  void SetRootNode(CYISceneNode *pRootNode);
314 
320  const std::shared_ptr<CYISceneNodeProxy> &GetRootNode() const;
321 
322  /* signals */
329 
330  /* supplemental signals */
339 
340 protected:
341  CYIAbstractTimeline(std::unique_ptr<CYIAbstractTimelinePriv> pPriv);
342 
343  std::unique_ptr<CYIAbstractTimelinePriv> m_pPriv;
344 
345 private:
348 };
349 
354 #endif /* _YI_ABSTRACT_TIMELINE_H_ */
CYISignal CompletedReverse
same as Completed, but triggered only when direction is reverse
Definition: YiAbstractTimeline.h:338
The base class for the timeline framework.
Definition: YiAbstractTimeline.h:29
bool ClearSourcePositions(CYISceneNode *pNode)
bool SetSourceScales(CYISceneNode *pNode, const glm::vec3 &scale)
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
Status
Definition: YiAbstractTimeline.h:55
CYISignal PausedReverse
same as Paused, but triggered only when direction is reverse
Definition: YiAbstractTimeline.h:334
uint64_t GetTotalTime() const
Status GetStatus() const
CYISignal PlayingForward
same as Playing, but triggered only when direction is forward
Definition: YiAbstractTimeline.h:331
The base class for types of timeline groups.
Definition: YiTimelineGroup.h:25
CYISignal TimelineLooped
called whenever a loop completes and the next loop starts
Definition: YiAbstractTimeline.h:328
CYISignal Paused
called whenever the timeline stops playing, including if the timeline execution completes normally ...
Definition: YiAbstractTimeline.h:324
CYISignal CompletedForward
same as Completed, but triggered only when direction is forward
Definition: YiAbstractTimeline.h:337
CYISignal PausedForward
same as Paused, but triggered only when direction is forward
Definition: YiAbstractTimeline.h:333
A class used to proxy access to a CYISceneNode.
Definition: YiSceneNodeProxy.h:26
void SeekToTime(uint64_t millis)
void SeekToPercentage(float percentage)
const std::shared_ptr< CYISceneNodeProxy > & GetRootNode() const
bool SetTargetPositions(CYISceneNode *pNode, const glm::vec3 &position)
void SetLooping(bool isLooping)
bool ClearSourceScales(CYISceneNode *pNode)
Direction
Definition: YiAbstractTimeline.h:64
CYISignal Completed
called when playback of the timeline completes normally (or when the Finish() function is called) ...
Definition: YiAbstractTimeline.h:327
void SetDirection(Direction direction)
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:99
void SetFrameModes(FrameMode startFrameMode, FrameMode endFrameMode)
void SetRootNode(CYISceneNode *pRootNode)
bool SetSourcePositions(CYISceneNode *pNode, const glm::vec3 &position)
const std::shared_ptr< CYITimelineProxy > & GetProxy() const
CYISignal PlayingReverse
same as Playing, but triggered only when direction is reverse
Definition: YiAbstractTimeline.h:332
FrameMode
Definition: YiAbstractTimeline.h:40
uint64_t GetCurrentTime() const
CYIAbstractTimeline(std::unique_ptr< CYIAbstractTimelinePriv > pPriv)
Definition: YiSignalHandler.h:175
CYISignal Aborted
called when the timeline execution is aborted by the Abort() function
Definition: YiAbstractTimeline.h:325
void SetDisablesInput(bool disablesInput)
bool ClearTargetPositions(CYISceneNode *pNode)
This kind of timeline group will play its children in parallel, possibly with specified offsets (dela...
Definition: YiParallelTimelineGroup.h:21
std::unique_ptr< CYIAbstractTimelinePriv > m_pPriv
Definition: YiAbstractTimeline.h:343
virtual ~CYIAbstractTimeline()
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
Repeats a timeline.
Definition: YiTimelineLoop.h:20
bool GetLooping() const
This kind of timeline group will play its children in sequence, possibly with specified offsets (dela...
Definition: YiSerialTimelineGroup.h:24
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
CYISignal StartedReverse
same as Started, but triggered only when direction is reverse
Definition: YiAbstractTimeline.h:336
uint64_t GetStartTime() const
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:168
Direction GetDirection() const
CYISignal Started
called when playback of the timeline is initiated by one of the Start() functions ...
Definition: YiAbstractTimeline.h:326
CYISignal Playing
called whenever the timeline starts playing (from any position)
Definition: YiAbstractTimeline.h:323
CYISignal StartedForward
same as Started, but triggered only when direction is forward
Definition: YiAbstractTimeline.h:335
float GetTimeAsPercentage() const