GameEngine
Manages the game loop / ticker, and system tickers.
JLS.engines.GameEngine
class GameEngine
// Implementation example
import { GameEngine } from 'path/to/engines'
GameEngine.register(sayHello) // will execute at 60x/sec
function sayHello() {
console.log('Say Hello')
}
Members
callbacks
A list of all registered functions.
Methods
ticker() static
Retrieves the shared ticker.
FPS() static
Gets the frames per second (FPS) of the ticker.
deltaTime() static
Gets the delta time, which is the elasped time since the last frame to this frame. Returns a scalar time.
deltaMS() static
Gets the delta time in milliseconds, which is the elasped time since the last frame. Returns milliseconds.
register(func) static
Registers a function to run at the current ticker speed / rate.
parameters
| Name | Type | Default | Description |
|---|---|---|---|
| func | function | --- | the function to execute on each flight loop. |
start() static
Starts the shared ticker.
stop() static
Stops the shared ticker.