Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface GamepadListener
Told about controllers coming and going and about their buttons. Register one
with Gamepads#addListener(GamepadListener); every callback arrives on the EDT.
Axis movement is not reported here, because a stick reports dozens of values
a second: read Gamepad#getAxis(int) from the update loop instead.
Methods
public abstract void gamepadConnected(Gamepad pad) | A controller was connected. |
public abstract void gamepadDisconnected(Gamepad pad) | A controller was disconnected; Gamepad#isConnected() is already false. |
public abstract boolean gamepadButton(Gamepad pad, int button, boolean down) | A button went down or up. |
Method details
gamepadConnected
public abstract void gamepadConnected(Gamepad pad)A controller was connected.
gamepadDisconnected
public abstract void gamepadDisconnected(Gamepad pad)A controller was disconnected;
Gamepad#isConnected() is already false.gamepadButton
public abstract boolean gamepadButton(Gamepad pad, int button, boolean down)A button went down or up.
Parameters
padGamepad- the controller
buttonint- one of the
Gamepad.BUTTON_*constants downboolean- true when pressed, false when released
Returns
true to consume the event, which stops
Gamepads from also turning it
into focus navigation