Class: PointerLock

Phaser. PointerLock

new PointerLock(game)

The pointer lock input handler.

Parameters:
Name Type Description
game Phaser.Game
Source:
src/input/PointerLock.js line 7

Members

<readonly> active : boolean

Whether the input handler is active.

Type:
  • boolean
Source:
src/input/PointerLock.js line 32

element : HTMLElement

The element where event listeners are added.

Type:
  • HTMLElement
Source:
src/input/PointerLock.js line 25

game : Phaser.Game

The currently running game.

Type:
Source:
src/input/PointerLock.js line 13

input : Phaser.Input

The Input Manager.

Type:
Source:
src/input/PointerLock.js line 19

locked : boolean

Whether the pointer is locked to the game canvas.

Type:
  • boolean
Source:
src/input/PointerLock.js line 38

onChange : Phaser.Signal

A signal dispatched when the pointer is locked or unlocked. Its arguments are Phaser.PointerLock#locked and the original event from the browser.

Type:
Source:
src/input/PointerLock.js line 45

onError : Phaser.Signal

A signal dispatched when a request to lock or unlock the pointer fails. Its argument is the original event from the browser.

Type:
Source:
src/input/PointerLock.js line 52

Methods

exit()

Releases the locked pointer. Use onChange and onError to track the result of the request.

Source:
src/input/PointerLock.js line 152

request()

Requests the browser to lock the pointer to the game canvas. Use onChange and onError to track the result of the request.

Source:
src/input/PointerLock.js line 137

start()

Activates the handler, unless already active or Pointer Lock is unsupported on this device.

Source:
src/input/PointerLock.js line 92
Returns:
  • True if the handler was started, otherwise false.
Type
boolean

stop()

Deactivates the handler.

Source:
src/input/PointerLock.js line 122

phaser-ce@2.20.1 is on GitHub and NPM

Documentation generated by JSDoc 3.6.11 on 2024-10-05 using Tomorrow.