Namespace: timer

me. timer

a Timer object to manage time function (FPS, Game Tick, Time...)

There is no constructor function for me.timer

Source:
timer.js, line 8

Members

<static> fps :Number

Last measured fps rate.
This feature is disabled by default. Load and enable the DebugPanel plugin to use it.
Type:
  • Number
Source:
timer.js, line 89

<static> lastUpdate :Date

Last update time.
Use this value to implement frame prediction in drawing events, for creating smooth motion while running game update logic at a lower fps.
Type:
  • Date
Source:
timer.js, line 100

<static> tick :Number

Last game tick value.
Use this value to scale velocities during frame drops due to slow hardware or when setting an FPS limit. (See me.sys.fps) This feature is disabled by default. Enable me.sys.interpolation to use it.
Type:
  • Number
Source:
timer.js, line 75
See:

Methods

<static> clearInterval(intervalID)

Clears the Interval set by me.timer.setInterval().
Parameters:
Name Type Description
intervalID Number ID of the interval to be cleared
Source:
timer.js, line 193

<static> clearTimeout(timeoutID)

Clears the delay set by me.timer.setTimeout().
Parameters:
Name Type Description
timeoutID Number ID of the timeout to be cleared
Source:
timer.js, line 182

<static> getDelta() → {Number}

Return elapsed time in milliseconds since the last update
Source:
timer.js, line 216
Returns:
Type
Number

<static> getTime() → {Number}

Return the current timestamp in milliseconds
since the game has started or since linux epoch (based on browser support for High Resolution Timer)
Source:
timer.js, line 204
Returns:
Type
Number

<static> setInterval(fn, delay, pauseable) → {Number}

Calls a function at specified interval.
Parameters:
Name Type Argument Default Description
fn function the function to execute
delay Number the number of milliseconds (thousandths of a second) on how often to execute the function
pauseable Boolean <optional>
true respects the pause state of the engine.
Source:
timer.js, line 160
Returns:
The numerical ID of the timeout, which can be used later with me.timer.clearInterval().
Type
Number

<static> setTimeout(fn, delay, pauseable) → {Number}

Calls a function once after a specified delay.
Parameters:
Name Type Argument Default Description
fn function the function you want to execute after delay milliseconds.
delay Number the number of milliseconds (thousandths of a second) that the function call should be delayed by.
pauseable Boolean <optional>
true respects the pause state of the engine.
Source:
timer.js, line 138
Returns:
The numerical ID of the timeout, which can be used later with me.timer.clearTimeout().
Type
Number
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:41+08:00 using the DocStrap template modified by codename-.