Interface GamepadListener


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.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    gamepadButton(Gamepad pad, int button, boolean down)
    A button went down or up.
    void
    A controller was connected.
    void
    A controller was disconnected; Gamepad#isConnected() is already false.
  • Method Details

    • gamepadConnected

      void gamepadConnected(Gamepad pad)
      A controller was connected.
    • gamepadDisconnected

      void gamepadDisconnected(Gamepad pad)
      A controller was disconnected; Gamepad#isConnected() is already false.
    • gamepadButton

      boolean gamepadButton(Gamepad pad, int button, boolean down)

      A button went down or up.

      Parameters
      • pad: the controller

      • button: one of the Gamepad.BUTTON_* constants

      • down: true when pressed, false when released

      Returns

      true to consume the event, which stops Gamepads from also turning it into focus navigation