global class used to notify the system of time updates
This class, accessed through the CYIFramework singleton, is used to drive animations, timelines, timers by informing them of the current time in a platform-independent way. No animation on the system can advance unless UpdateTime() is called on a regular basis.
#include <utility/YiTime.h>
Classes | |
class | UpdateListener |
Public Member Functions | |
CYITime () | |
virtual | ~CYITime () |
void | UpdateTime (bool notifyListeners=true) |
void | UpdateTime (std::chrono::microseconds deltaTime, bool notifyListeners=true) |
void | RegisterTimeUpdateListener (CYITime::UpdateListener *pListener) |
void | UnregisterTimeUpdateListener (CYITime::UpdateListener *pListener) |
bool | HasListeners () const |
uint64_t | GetListenerCount () const |
std::chrono::microseconds | GetFrameTime () |
uint64_t | GetRefTime () |
uint32_t | GetLastUpdateStatus () |
void | EnableFixedTimeStep (std::chrono::microseconds fixedTimeStep) |
bool | IsFixedTimeStepEnabled () const |
void | DisableFixedTimeStep () |
void | SetTimeDilationFactor (float factor) |
float | GetTimeDilationFactor () const |
Public Attributes | |
CYISignal | TimeConfigurationChanged |
Static Public Attributes | |
static const uint32_t | UPDATE_STATUS_NONE |
A bitfield value indicating no update status. More... | |
static const uint32_t | UPDATE_STATUS_DISABLE_INPUT |
A bitfield value indicating that input is disabled. More... | |
static const uint32_t | UPDATE_STATUS_SCENE_DIRTY |
A bitfield value indicating that the scene is dirty. More... | |
Protected Member Functions | |
void | NotifyTimeUpdated (std::chrono::microseconds frameTime) |
CYITime::CYITime | ( | ) |
|
virtual |
void CYITime::DisableFixedTimeStep | ( | ) |
Disable running the application at a fixed time-step.
void CYITime::EnableFixedTimeStep | ( | std::chrono::microseconds | fixedTimeStep | ) |
Enable running the application at a fixed time-step. Systems making use of CYITime (such as implementations of CYITime::UpdateListener) will receive fixedTimeStep as the time delta between frames instead of the true elapsed time. Zero is a special value equivalent to DisableFixedTimeStep.
std::chrono::microseconds CYITime::GetFrameTime | ( | ) |
Returns the frame time, i.e. the delta time between the last two time updates
uint32_t CYITime::GetLastUpdateStatus | ( | ) |
Returns any status flags since last call to UpdateTime();
uint64_t CYITime::GetListenerCount | ( | ) | const |
Returns the number of registered listeners.
uint64_t CYITime::GetRefTime | ( | ) |
Returns the reference time, in milliseconds. Exact meaning of the value is unspecified, so it is useful only through comparison with another reference time acquired previously
float CYITime::GetTimeDilationFactor | ( | ) | const |
Gets the current time dilation factor. 1.0 represents normal execution speed.
bool CYITime::HasListeners | ( | ) | const |
Returns true if there are any registered listeners.
bool CYITime::IsFixedTimeStepEnabled | ( | ) | const |
Returns true if the application is running at a fixed time-step. The default state is false, will also become false if EnableFixedTimeStep is called with a value of zero or if DisableFixedTimeStep is called.
|
protected |
void CYITime::RegisterTimeUpdateListener | ( | CYITime::UpdateListener * | pListener | ) |
Registers a new listener for notification of time updates
void CYITime::SetTimeDilationFactor | ( | float | factor | ) |
Sets the time dilation factor to factor. The time dilation factor affects how fast time appears to pass in You.i Engine. By default, the factor is 1.0. When larger than 1.0, time appears to pass faster than normal. When smaller than 1.0, time appears to pass slower than normal.
The time dilation factor only affects the frame time. Animations and timers are affected by modified frame times. The values returned by the GetRefTime() and the YiGetTimeuS() functions are not affected.
void CYITime::UnregisterTimeUpdateListener | ( | CYITime::UpdateListener * | pListener | ) |
Unregisters a listener from notification of time updates
void CYITime::UpdateTime | ( | bool | notifyListeners = true | ) |
Updates frame time and ref time according to the time elapsed since this function was last called. Notifies the listeners of the time update.
void CYITime::UpdateTime | ( | std::chrono::microseconds | deltaTime, |
bool | notifyListeners = true |
||
) |
Updates frame time and ref time according to the provided delta time. Notifies the listeners of the time update. Using this function can be used to make time-based activities (animations, timers etc) operate faster or slower than real time.
CYISignal CYITime::TimeConfigurationChanged |
|
static |
A bitfield value indicating that input is disabled.
|
static |
A bitfield value indicating no update status.
|
static |
A bitfield value indicating that the scene is dirty.