Skip to content
daemonburrito edited this page May 6, 2011 · 4 revisions

CubicVR.Timer

The Timer class provides basic timing and seeking functions. A Timer is provided by the CubicVR.MainLoop loop function callback.

Constructor:

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 automatically 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.

Parameters:

  • f_rate - Frames per second.

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 pause or unpause, respectively.

Returns:

none


getPaused()

Purpose:

Return the paused state of the timer.

Returns:

true if paused, false if not.

Clone this wiki locally