You.i Engine
CYITime Class Reference

Detailed Description

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 ()
 
void UpdateTime (uint64_t uDeltaTime)
 
void SetTimeDilationFactor (float fFactor)
 
void RegisterTimeUpdateListener (CYITime::UpdateListener *pListener)
 
void UnregisterTimeUpdateListener (CYITime::UpdateListener *pListener)
 
bool HasListeners () const
 
std::chrono::microseconds GetFrameTime ()
 
uint64_t GetRefTime ()
 
uint32_t GetLastUpdateStatus ()
 

Static Public Attributes

static const uint32_t UPDATE_STATUS_NONE = 0x00000000
 
static const uint32_t UPDATE_STATUS_DISABLE_INPUT = 0x00000001
 
static const uint32_t UPDATE_STATUS_SCENE_DIRTY = 0x00000002
 

Protected Member Functions

void NotifyTimeUpdated (std::chrono::microseconds nFrameTime)
 

Constructor & Destructor Documentation

CYITime::CYITime ( )
virtual CYITime::~CYITime ( )
virtual

Member Function Documentation

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::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

bool CYITime::HasListeners ( ) const

Returns true if there are any registered listeners.

See also
RegisterTimeUpdateListener
UnregisterTimeUpdateListener
void CYITime::NotifyTimeUpdated ( std::chrono::microseconds  nFrameTime)
protected
void CYITime::RegisterTimeUpdateListener ( CYITime::UpdateListener pListener)

Registers a new listener for notification of time updates

void CYITime::SetTimeDilationFactor ( float  fFactor)

Sets the time dilation factor to fFactor. 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.

Note
Negative and zero values are not supported.
void CYITime::UnregisterTimeUpdateListener ( CYITime::UpdateListener pListener)

Unregisters a listener from notification of time updates

void CYITime::UpdateTime ( )

Queries the system time and updates the frame time and reference time accordingly. Notifies the listeners of the time update

void CYITime::UpdateTime ( uint64_t  uDeltaTime)

Updates frame time and ref time according to the provided delta time. Actual system time is not queried. 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.

See also
GetFrameTime()
GetRefTime()
GetLastUpdateStatus()

Member Data Documentation

const uint32_t CYITime::UPDATE_STATUS_DISABLE_INPUT = 0x00000001
static
const uint32_t CYITime::UPDATE_STATUS_NONE = 0x00000000
static
const uint32_t CYITime::UPDATE_STATUS_SCENE_DIRTY = 0x00000002
static

The documentation for this class was generated from the following file: