GameUtils

GameUtils

Shims for standard gaming features
Only used to define the class. Should never be instantiated.

Constructor

new GameUtils()

Members

(static) supported :Object

Supported features. All true by default.

Properties:
Name Type Description
fullscreen boolean
pointerLock boolean

Methods

(static) addVisibilityChangeListener(callback)

Add a visibilitychange listener.

Parameters:
Name Type Description
callback function

function called with a boolean (true=hidden, false=visible)

(static) exitFullScreen()

Attempts to exit fullscreen.

(static) exitPointerLock()

Attempts to unlock the mouse pointer in the window.

(static) initAllShims(globalopt)

Attempts to initialize all shims (animation, fullscreen, pointer lock).

Parameters:
Name Type Attributes Default Description
global Element <optional>
window

The global element (for compatibility checks and patching)

(static) initAnimationShims()

Attempts to initialize the animation shim, ie. defines requestAnimationFrame and cancelAnimationFrame

(static) initFullscreenShims(globalopt)

Attempts to initialize the fullscreen shim, ie. defines requestFullscreen and cancelFullscreen

Parameters:
Name Type Attributes Default Description
global Element <optional>
window

The global element (for compatibility checks and patching)

(static) initPointerLockShims(globalopt)

Attempts to initialize the pointer lock shim, ie. define requestPointerLock and exitPointerLock

Parameters:
Name Type Attributes Default Description
global Element <optional>
window

The global element (for compatibility checks and patching)

(static) initWebGLShims()

Handle missing WebGL features like IE 11 Uint8ClampedArray

(static) requestFullScreen()

Attempts to request fullscreen.

(static) requestPointerLock()

Attempts to lock the mouse pointer in the window.

(static) toggleFullScreen()

Attempts to toggle fullscreen.

(static) togglePointerLock()

Attempts to toggle the lock on the mouse pointer in the window.