Class: Time

rune.system.Time(framerateopt)

The Time class is used to calculate the elapsed time within an application. Calculated time is used to run the application's update and rendering loop.

Constructor

new Time(framerateopt)

Creates a new instance of the Time class.
Parameters:
Name Type Attributes Default Description
framerate number <optional>
60 Target framerate.
Source:

Members

(readonly) currentFramerate :number

Current frame rate, ie an indication of whether the application is executed at the requested frame rate. If the application is executed correctly, the current frame rate should be the same as the requested frame rate.
Type:
  • number
Source:

framerate :number

Target framerate.
Type:
  • number
Source:

(readonly) quotient :number

Current frame rate divided by target frame rate.
Type:
  • number
Source:

(readonly) render :rune.util.Stack

Represents the rendering stack, ie a list of methods that aim to draw the application's graphics to the screen for each active frame.
Type:
Source:

(readonly) scale :number

Time scale relative to the system's maximum capacity. An application can calculate up to 60 ticks per second, this corresponds to scale 1.0. If an application is executed at 30 ticks per second, the time scale is 2.0. This information is important if you want to create an application that is executed at the same speed regardless of the application's frame rate.
Type:
  • number
Source:

(readonly) step :number

Describes the theoretical length of a frame in milliseconds.
Type:
  • number
Source:

(readonly) update :rune.util.Stack

Represents the update stack, ie a list of methods that aim to perform the necessary calculations for each frame. This stack is always executed before the rendering stack.
Type:
Source:

Methods

reset() → {undefined}

Resets the update and rendering loop.
Source:
Returns:
Type
undefined

start() → {undefined}

Starts the update and rendering loop.
Source:
Returns:
Type
undefined

stop(clearopt) → {undefined}

Stops the update and rendering loop.
Parameters:
Name Type Attributes Default Description
clear boolean <optional>
false Whether the update and render stacks should be emptied or not.
Source:
Returns:
Type
undefined