Create a new instance of a Controller.
Helper function to append an action.
The name of the action.
An action object to add.
Optional
button?: numberMouse: e.g. pc.MOUSEBUTTON_LEFT
- Gamepad: e.g. pc.PAD_FACE_1
Optional
keys?: number[]Keyboard: A list of keycodes e.g. [pc.KEY_A, pc.KEY_ENTER]
.
Optional
pad?: numberGamepad: An index of the pad to register (use PAD_1, etc).
The name of the action.
Attach Controller to an Element. This is required before you can monitor for key/mouse inputs.
The element to attach mouse and keyboard event handler too.
Detach Controller from an Element. This should be done before the Controller is destroyed.
Disable the context menu usually activated with the right mouse button.
Enable the context menu usually activated with the right mouse button. This is enabled by default.
Returns true if the current action is enabled.
The name of the action.
True if the action is enabled.
Register an action against a controller axis.
Optional
options: { pad?: number }Optional options object.
Optional
pad?: numberThe index of the game pad to register for (use PAD_1, etc).
Create or update a action which is enabled when the supplied keys are pressed.
The name of the action.
A list of keycodes.
Create or update an action which is enabled when the supplied mouse button is pressed.
The name of the action.
The mouse button.
Create or update an action which is enabled when the gamepad button is pressed.
The name of the action.
The index of the pad to register (use PAD_1, etc).
The pad button.
Update the Keyboard and Mouse handlers.
The time since the last frame.
Returns true if the action was enabled this since the last update.
The name of the action.
True if the action was enabled this since the last update.
A general input handler which handles both mouse and keyboard input assigned to named actions. This allows you to define input handlers separately to defining keyboard/mouse configurations.