The timeline base class. More...
#include "murl_util_timeline.h"
Public Member Functions | |
Timeline () | |
The default constructor. | |
virtual | ~Timeline () |
The destructor. | |
void | Reset () |
Reset the timeline. More... | |
void | ResetTo (Real startTime) |
Reset the timeline to a specified start time. More... | |
Bool | Start () |
Start or continue the timeline. More... | |
Bool | Start (Real startTime, Real endTime) |
Start the timeline with specified parameters. More... | |
Bool | Start (Real startTime, Real endTime, SInt32 numberOfLoops) |
Start the timeline with specified parameters. More... | |
Bool | Start (Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) |
Start the timeline with specified parameters. More... | |
Bool | Pause () |
Pause the timeline. More... | |
Bool | Stop () |
Stop the timeline. More... | |
Bool | Rewind () |
Rewind the timeline. More... | |
void | SetStartTime (Real startTime) |
Set the start time. More... | |
Real | GetStartTime () const |
Get the start time. More... | |
void | SetEndTime (Real endTime) |
Set the end time. More... | |
Real | GetEndTime () const |
Get the end time. More... | |
void | SetLoopStartTime (Real startTime) |
Set the loop start time. More... | |
Real | GetLoopStartTime () const |
Get the loop start time. More... | |
void | SetLoopEndTime (Real endTime) |
Set the loop end time. More... | |
Real | GetLoopEndTime () const |
Get the loop end time. More... | |
void | SetStartLoop (SInt32 startLoop) |
Set the start loop. More... | |
SInt32 | GetStartLoop () const |
Get the start loop. More... | |
void | SetNumberOfLoops (SInt32 numberOfLoops) |
Set the number of loops. More... | |
SInt32 | GetNumberOfLoops () const |
Get the number of loops. More... | |
void | SetTimeScale (Real timeScale) |
Set the time scale factor. More... | |
Real | GetTimeScale () const |
Get the time scale factor. More... | |
void | SetAutoRewindEnabled (Bool enabled) |
Enable/disable automatic rewind. More... | |
Bool | IsAutoRewindEnabled () const |
Check if automatic rewind is enabled. More... | |
Bool | IsRunning () const |
Check if the timeline is running. More... | |
Bool | IsPaused () const |
Check if the timeline is paused. More... | |
Bool | IsStopped () const |
Check if the timeline is stopped. More... | |
Bool | WasStarted () const |
Check if the timeline was started from stopped state. More... | |
Bool | WasRunning () const |
Check if the timeline has stopped running. More... | |
Bool | IsOrWasRunning () const |
Check if the timeline is or was running. More... | |
Bool | HasPassedTime (Real time) const |
Check if the current time has passed a specified time within the most recent tick. More... | |
Bool | HasPassedLoop (SInt32 loop=-1) const |
Check if the current loop has passed a specified loop number within the most recent tick. More... | |
Double | GetRecentTime () const |
Get the recent time. More... | |
Double | GetCurrentTime () const |
Get the current time. More... | |
Double | GetRemainingTime () const |
Get the remaining time. More... | |
void | SetCurrentTime (Double time) |
Set the current time. More... | |
SInt32 | GetRecentLoop () const |
Get the recent loop. More... | |
SInt32 | GetCurrentLoop () const |
Get the current loop. More... | |
SInt32 | GetRemainingLoops () const |
Get the remaining loops. More... | |
Bool | SetCurrentLoop (SInt32 loop) |
Set the current loop. More... | |
IEnums::AnimationState | GetRecentState () const |
Get the recent animation state. More... | |
IEnums::AnimationState | GetCurrentState () const |
Get the current animation state. More... | |
Bool | ProcessTimeline (Double deltaTime) |
Process the timeline. More... | |
Detailed Description
The timeline base class.
The timeline base class is used to implement the Graph::ITimeline and the Logic::ITimeline object.
Member Function Documentation
◆ Reset()
void Murl::Util::Timeline::Reset | ( | ) |
Reset the timeline.
Stop the timeline, reset the WasRunning() state and call Rewind().
◆ ResetTo()
void Murl::Util::Timeline::ResetTo | ( | Real | startTime | ) |
Reset the timeline to a specified start time.
Set the start time and call Reset().
- Parameters
-
startTime The start time in seconds.
◆ Start() [1/4]
Bool Murl::Util::Timeline::Start | ( | ) |
Start or continue the timeline.
Reset the WasRunning() state. Does not modify the current time and loop.
- Returns
- true if successful.
◆ Start() [2/4]
◆ Start() [3/4]
◆ Start() [4/4]
Bool Murl::Util::Timeline::Start | ( | Real | startTime, |
Real | endTime, | ||
Real | loopStartTime, | ||
Real | loopEndTime, | ||
SInt32 | numberOfLoops | ||
) |
Start the timeline with specified parameters.
Set start/end time, loop start/end time, number of loops, calls Rewind() and Start().
- Parameters
-
startTime The start time in seconds. endTime The end time in seconds. loopStartTime The loop start time in seconds. loopEndTime The loop end time in seconds. numberOfLoops Number of loops.
- Returns
- true if successful.
◆ Pause()
Bool Murl::Util::Timeline::Pause | ( | ) |
Pause the timeline.
- Returns
- true if timeline was paused, false if timeline is not running.
◆ Stop()
Bool Murl::Util::Timeline::Stop | ( | ) |
Stop the timeline.
Rewind() is called if auto rewind is enabled.
- Returns
- true if timeline was stopped, false if timeline is already stopped.
◆ Rewind()
Bool Murl::Util::Timeline::Rewind | ( | ) |
Rewind the timeline.
Sets the current time to the start time and the current loop to the start loop. Does not affect the current running state.
- Returns
- true if successful.
◆ SetStartTime()
void Murl::Util::Timeline::SetStartTime | ( | Real | startTime | ) |
Set the start time.
- Parameters
-
startTime The start time in seconds.
◆ GetStartTime()
Real Murl::Util::Timeline::GetStartTime | ( | ) | const |
Get the start time.
- Returns
- The start time in seconds.
◆ SetEndTime()
void Murl::Util::Timeline::SetEndTime | ( | Real | endTime | ) |
Set the end time.
- Parameters
-
endTime The end time in seconds.
◆ GetEndTime()
Real Murl::Util::Timeline::GetEndTime | ( | ) | const |
Get the end time.
- Returns
- The end time in seconds.
◆ SetLoopStartTime()
void Murl::Util::Timeline::SetLoopStartTime | ( | Real | startTime | ) |
Set the loop start time.
- Parameters
-
startTime The loop start time in seconds.
◆ GetLoopStartTime()
Real Murl::Util::Timeline::GetLoopStartTime | ( | ) | const |
Get the loop start time.
- Returns
- The loop start time in seconds.
◆ SetLoopEndTime()
void Murl::Util::Timeline::SetLoopEndTime | ( | Real | endTime | ) |
Set the loop end time.
- Parameters
-
endTime The loop end time in seconds.
◆ GetLoopEndTime()
Real Murl::Util::Timeline::GetLoopEndTime | ( | ) | const |
Get the loop end time.
- Returns
- The loop end time in seconds.
◆ SetStartLoop()
void Murl::Util::Timeline::SetStartLoop | ( | SInt32 | startLoop | ) |
Set the start loop.
Loop #0 is considered the intro, if it is desired to start right in the middle of the first actual loop, the start loop should be set to 1.
- Parameters
-
startLoop The start loop.
◆ GetStartLoop()
SInt32 Murl::Util::Timeline::GetStartLoop | ( | ) | const |
Get the start loop.
- Returns
- The start loop.
◆ SetNumberOfLoops()
void Murl::Util::Timeline::SetNumberOfLoops | ( | SInt32 | numberOfLoops | ) |
Set the number of loops.
- Parameters
-
numberOfLoops Number of loops.
◆ GetNumberOfLoops()
SInt32 Murl::Util::Timeline::GetNumberOfLoops | ( | ) | const |
Get the number of loops.
- Returns
- The number of loops.
◆ SetTimeScale()
void Murl::Util::Timeline::SetTimeScale | ( | Real | timeScale | ) |
Set the time scale factor.
The recent tick duration is multiplied by the time scale factor and added to the current time each logic tick. The default time scale factor is 1.
- Parameters
-
timeScale The time scale factor.
◆ GetTimeScale()
Real Murl::Util::Timeline::GetTimeScale | ( | ) | const |
Get the time scale factor.
- Returns
- true The time scale factor.
◆ SetAutoRewindEnabled()
void Murl::Util::Timeline::SetAutoRewindEnabled | ( | Bool | enabled | ) |
Enable/disable automatic rewind.
Automatic rewind is calling Rewind() when the timeline is stopped.
- Parameters
-
enabled Enable automatic rewind if true.
◆ IsAutoRewindEnabled()
Bool Murl::Util::Timeline::IsAutoRewindEnabled | ( | ) | const |
Check if automatic rewind is enabled.
- Returns
- true if automatic rewind.
◆ IsRunning()
Bool Murl::Util::Timeline::IsRunning | ( | ) | const |
◆ IsPaused()
Bool Murl::Util::Timeline::IsPaused | ( | ) | const |
◆ IsStopped()
Bool Murl::Util::Timeline::IsStopped | ( | ) | const |
◆ WasStarted()
Bool Murl::Util::Timeline::WasStarted | ( | ) | const |
Check if the timeline was started from stopped state.
- Returns
- true if started.
◆ WasRunning()
Bool Murl::Util::Timeline::WasRunning | ( | ) | const |
Check if the timeline has stopped running.
If the timeline is stopped this state is true within the current logic tick only and will be cleared at the next logic tick.
(!) This state remains unchanged if the timeline is no longer processed. In such a case the Reset() method can be called to clear the state.
- Returns
- true if stopped.
◆ IsOrWasRunning()
Bool Murl::Util::Timeline::IsOrWasRunning | ( | ) | const |
Check if the timeline is or was running.
Returns (IsRunning() || WasRunning()) state.
- Returns
- true if IsRunning() or WasRunning() is true.
◆ HasPassedTime()
Check if the current time has passed a specified time within the most recent tick.
Does not consider loops, for evaluating loops see HasPassedLoop().
- Parameters
-
time The time to check in seconds.
- Returns
- true if the current time has passed a specified time within the most recent tick.
◆ HasPassedLoop()
Check if the current loop has passed a specified loop number within the most recent tick.
If the loop number to check is negative, true is returned each time the current loop has changed.
- Parameters
-
loop The loop number to check.
- Returns
- true if the current loop has passed a specified loop within the most recent tick.
◆ GetRecentTime()
Double Murl::Util::Timeline::GetRecentTime | ( | ) | const |
Get the recent time.
- Returns
- The recent time in seconds.
◆ GetCurrentTime()
Double Murl::Util::Timeline::GetCurrentTime | ( | ) | const |
Get the current time.
This method does not consider loops, for evaluating loops see GetCurrentLoop().
- Returns
- The current time in seconds.
◆ GetRemainingTime()
Double Murl::Util::Timeline::GetRemainingTime | ( | ) | const |
Get the remaining time.
This method calculates GetEndTime() - GetCurrentTime() which does not consider loops, for evaluating loops see GetCurrentLoop().
- Returns
- The remaining time in seconds.
◆ SetCurrentTime()
void Murl::Util::Timeline::SetCurrentTime | ( | Double | time | ) |
Set the current time.
This method does not consider loops, for setting loops see SetCurrentLoop().
- Parameters
-
time The current time to set in seconds.
◆ GetRecentLoop()
SInt32 Murl::Util::Timeline::GetRecentLoop | ( | ) | const |
Get the recent loop.
- Returns
- The recent loop.
◆ GetCurrentLoop()
SInt32 Murl::Util::Timeline::GetCurrentLoop | ( | ) | const |
Get the current loop.
The current loop provides the following information for n loops:
- 0 Intro running from start to loop start time.
- 1 .. n Loop running from loop start to loop end time.
- n + 1 Outro running from loop end to end time.
- Returns
- The current loop, 0 if number of loops is 0.
◆ GetRemainingLoops()
SInt32 Murl::Util::Timeline::GetRemainingLoops | ( | ) | const |
Get the remaining loops.
Calculates GetNumberOfLoops() - GetCurrentLoop().
- Returns
- The remaining loops, -1 if number of loops is < 0, 0 if number of loops is 0 or intro/outro is running.
◆ SetCurrentLoop()
Set the current loop.
The current loop represents the following information for n loops:
- 0 Intro running from start to loop start time.
- 1 .. n Loop running from loop start to loop end time.
- n + 1 Outro running from loop end to end time.
- Parameters
-
loop The current loop to set.
- Returns
- true if successful, false if the loop number is out of range.
◆ GetRecentState()
IEnums::AnimationState Murl::Util::Timeline::GetRecentState | ( | ) | const |
Get the recent animation state.
- Returns
- The recent animation state.
◆ GetCurrentState()
IEnums::AnimationState Murl::Util::Timeline::GetCurrentState | ( | ) | const |
Get the current animation state.
- Returns
- The current animation state.
◆ ProcessTimeline()
Process the timeline.
- Parameters
-
deltaTime The recent tick duration in seconds.
- Returns
- true if the timeline was processed.
The documentation for this class was generated from the following file:
- murl_util_timeline.h