-
Notifications
You must be signed in to change notification settings - Fork 0
API InputController
Initializes the InputController with the canvas and camera objects
-
Arguments:
-
{Canvas} canvas
-
{Camera} camera
-
Usage:
Ludic.input = new InputController(canvas, camera)
Adds an event listener to the controller
- Arguments:
-
{InputEventListener} listener
- listener to be added
Removes the listener from the controller
- Arguments:
-
{InputEventListener} listener
- listener to be removed
Creates a new event listener. Can also add the listener to the controller
-
Arguments:
-
{Object} keyConfig
- Options object for mapping keys to methods/actions -
{Object} [binder]
- [optional] object used for binding the call of listener methods -
{boolean} [alsoAdd]
- [optional] tells the controller to also add the returns listener to the controller -
Returns:
-
{InputEventListener}
- A newInputEventListener
for which to mount callbacks -
Usage:
Steps the polling process when processing Gamepad usage. Not required for keyboard/mouse input handling. Add this function to the main loop to handle Gamepad event processing.
Gets the dead zone number for a specific gamepad. If no specific dead zone was set for the gamepad, the global dead zone is returned.
-
Arguments:
-
{Number} gamepadIndex
- index of the gamepad to retrieve dead zone from -
Returns:
-
{Number} dead zone
- either the dead zone set for the specific gamepad, or the global dead zone setting
Sets the dead zone for a specific gamepad. If no gamepadIndex
is supplied, the deadZone
is set as the global setting.
- Arguments:
-
{Number} deadZone
- a value between 0-1 to be used as the dead zone on the analog sticks for the gamepads -
{Number} [gamepadIndex]
- [optional] index for a specific gamepad to set dead zone for