Class: Input

Input

The Input class allows mapping user input to named actions to simplify handling different input types. For example, Mouse's movement and TouchInput's touch movements can both be used to look around. This can be done by enabling their input plugins Mouse and Touch while mapping their axes (for example: Mouse#MOVE_X, Mouse#MOVE_Y, Touch#MOVE_X, Touch#MOVE_X} to "actions" (usually strings or enum values). You can then poll the actions to get the input value assigned to it from any input device. When supporting multiple users on a single device, multiple Input classes can be created with each having their own mappings.


new Input()

Properties:
Name Type Description
onAction Signal

A Signal that dispatches whenever an action value changes. This should be listened to for "triggered" events, not for continuous "while button down" events. For example: jumping is normally a triggered event, while walking is continuous and would be polled using Input#getValue.

Author:
  • derschmale <http://www.derschmale.com>

Methods


disable()

Disables an input plugin.

{@see Gamepad} {@see Keyboard} {@see Mouse} {@see MouseLock} {@see Touch}


enable()

Enables an input plugin.

{@see Gamepad} {@see Keyboard} {@see Mouse} {@see MouseLock} {@see Touch}


getValue()

Gets the value currently associated with an action.