-
Notifications
You must be signed in to change notification settings - Fork 103
Timer
cjcliffe edited this page Feb 22, 2011
·
4 revisions
The Timer class provides basic timing and seeking functions. A Timer is provided by the CubicVR.MainLoop loop function callback.
### _Timer()_
## Methods:
### _start()_ **Purpose**: Start the timer and initialize time to 0. **Returns**: none
### _update()_ **Purpose**: Update the timer for the current frame and step the timer. This will be called automaticaly by MainLoop. **Returns**: none
### _stop()_ **Purpose**: Stop the timer and mark the *end_time* property. **Returns**: none
### _reset()_ **Purpose**: Start the timer and reset time to 0. **Returns**: none
### _lockFramerate( f_rate )_ **Purpose**: Force time intervals to *f_rate* frames per second regardless of actual time. **Returns**: none
### _unlock()_ **Purpose**: Disable any calls to lockFramerate(..). **Returns**: none
### _locked()_ **Purpose**: Checks if the timer is locked or not. **Returns**: TRUE if framerate is locked, FALSE if not.
### _getMilliseconds()_ **Purpose**: Get the current time in Milliseconds. **Returns**: Time in Milliseconds
### _getSeconds()_ **Purpose**: Get the current time in Seconds. **Returns**: Time in Seconds
### _setMilliseconds( milliseconds )_ **Purpose**: Set the current time in Milliseconds. **Parameters**: *milliseconds* - Millseconds to set the time to. **Returns**: none
### _setSeconds( seconds )_ **Purpose**: Set the current time in Seconds. **Parameters**: *seconds* - Seconds to set the time to. **Returns**: none
### _getLastUpdateSeconds()_ **Purpose**: Return the time interval between this update and last in Seconds. **Returns**: Time interval betwen update() in Seconds
### _getLastUpdateMilliseconds()_ **Purpose**: Return the time interval between this update and last in Milliseconds. **Returns**: Time interval betwen update() in Milliseconds
### _getTotalMilliseconds()_ **Purpose**: Get the total time (excluding pauses and time shifts). **Returns**: Total time in Milliseconds
### _getTotalSeconds()_ **Purpose**: Get the total time (excluding pauses and time shifts). **Returns**: Total time in Seconds
### _getNumUpdates()_ **Purpose**: Get the total number of calls to update(). **Returns**: Total number of calls to update()
### _setPaused( paused )_ **Purpose**: Set the paused state of the timer. While paused the timer will continue to run but maintain the current time. **Parameters**: *paused* - true or false to paus or unpause respectively. **Returns**: none
### _getPaused()_ **Purpose**: Return the paused state of the timer. **Returns**: true if paused, false if not.