Optionaloptions: GamepadPluginOptions = {}
the controls, their look and how they behave
Optionalapp: Application
the application the controls belong to, the running one
by default: plugin.register(GamepadPlugin, "gamepad", options, app)
a reference to the app/game that registered this plugin
Readonlybuttonsthe buttons, in the order of the options
Readonlyindexthe gamepad slot the controls report in
Readonlysticksthe sticks, in the order of the options
define the minimum required version of melonJS this can be overridden by the plugin
Whether the controls are switched on. Set it to show or hide them at any time, as on a stage that only needs a tap. Switched off, they let go of everything they held.
The controls can be switched on and still hidden, while the player uses a real pad: GamepadPlugin#visible says whether they show.
Whether the controls are on the screen: switched on, and not hidden for a real pad. A game can read it to word its prompts ("tap" rather than a key).
On-screen touch controls, reported as a gamepad: sticks and buttons drawn over the game, read by the engine as a pad in a gamepad slot. Everything a game binds with
input.bindGamepadanswers to them, so the same code reads a real pad and the touch controls.Register it once the application is created:
The controls follow each finger on its own, so a stick can be held while a button is pressed; a touch that starts on a control does not reach the game. They are drawn over the whole frame, above every renderable and every camera, and outlive stage changes.