me.sys

global system settings and browser capabilities

Members

static autoFocus :Boolean

Specify whether to automatically bring the window to the front.

Default Value:
  • true

static fps :Number

Set game FPS limiting

Default Value:
  • 60
See:

static gravity :Number

Global y axis gravity settings. (will override body gravity value if defined)

Default Value:
  • undefined

static interpolation :Boolean

Enable/disable frame interpolation

Default Value:
  • false
See:

static pauseOnBlur :Boolean

Specify whether to pause the game when losing focus.

Default Value:
  • true

static preRender :Boolean

Specify the rendering method for layers
if false, visible part of the layers are rendered dynamically
if true, the entire layers are first rendered into an offscreen canvas
the "best" rendering method depends of your game
(amount of layer, layer size, amount of tiles per layer, etc.)
note : rendering method is also configurable per layer by adding this property to your layer (in Tiled)

Default Value:
  • false

static resumeOnFocus :Boolean

Specify whether to unpause the game when gaining focus.

Default Value:
  • true

static scale :me.Vector2d

Global scaling factor

Default Value:
  • <0,0>

static stopOnAudioError :Boolean

Specify either to stop on audio loading error or not
if true, melonJS will throw an exception and stop loading
if false, melonJS will disable sounds and output a warning message in the console

Default Value:
  • true

static stopOnBlur :boolean

Specify whether to stop the game when losing focus or not
The engine restarts on focus if this is enabled.

Default Value:
  • false

static updatesPerSecond :Number

Rate at which the game updates;
may be greater than or lower than the fps

Default Value:
  • 60
See:

Methods

static checkVersion(first, secondopt) → {Number}

Compare two version strings

Parameters:
Name Type Attributes Default Description
first String

First version string to compare

second String <optional>
"__VERSION__"

Second version string to compare

Returns:
Number -

comparison result
< 0 : first < second
0 : first == second
> 0 : first > second

Example
if (me.sys.checkVersion("__VERSION__") > 0) {
    console.error(
        "melonJS is too old. Expected: __VERSION__, Got: " + me.version
    );
}