Class GamepadEvents

Direct Known Subclasses:
Gamepad, GamepadManager

public abstract class GamepadEvents
The GamepadEvents class is the engine's implementation for receiving gamepad input events.
  • Field Details

  • Constructor Details

    • GamepadEvents

      protected GamepadEvents()
  • Method Details

    • onValueChanged

      public void onValueChanged(de.gurkenlabs.input4j.InputComponent.ID id, GamepadEvents.GamepadValueChangedListener listener)
      Adds the specified gamepad poll listener to receive events when the component with the defined identifier has been polled.
      Parameters:
      id - The component identifier for which to add the listener.
      listener - The listener to add.
    • onButtonPressed

      public void onButtonPressed(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonPressedListener listener)
      Adds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.
      Parameters:
      identifier - The component identifier for which to add the listener.
      listener - The listener to add.
    • onButtonPressed

      public void onButtonPressed(int id, GamepadEvents.GamepadButtonPressedListener listener)
      Adds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.
      Parameters:
      id - The component identifier for which to add the listener.
      listener - The listener to add.
    • onButtonReleased

      public void onButtonReleased(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonReleasedListener listener)
      Adds the specified gamepad released listener to receive events when the component with the defined identifier has been released.
      Parameters:
      identifier - The component identifier for which to add the listener.
      listener - The listener to add.
    • onButtonReleased

      public void onButtonReleased(int id, GamepadEvents.GamepadButtonReleasedListener listener)
      Adds the specified gamepad released listener to receive events when the component with the defined identifier has been released.
      Parameters:
      id - The component identifier for which to add the listener.
      listener - The listener to add.
    • onValueChanged

      public void onValueChanged(GamepadEvents.GamepadValueChangedListener listener)
      Adds the specified gamepad poll listener to receive events when any component has been polled.
      Parameters:
      listener - The listener to add.
    • onButtonPressed

      public void onButtonPressed(GamepadEvents.GamepadButtonPressedListener listener)
      Adds the specified gamepad pressed listener to receive events when any component has been pressed.
      Parameters:
      listener - The listener to add.
    • onButtonReleased

      public void onButtonReleased(GamepadEvents.GamepadButtonReleasedListener listener)
      Adds the specified gamepad released listener to receive events when any component has been released.
      Parameters:
      listener - The listener to add.
    • removePollListener

      public void removePollListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadValueChangedListener listener)
      Unregister the specified poll listener from gamepad events.
      Parameters:
      identifier - The component identifier for which to remove the listener.
      listener - The listener to remove.
    • removeButtonPressedListener

      public void removeButtonPressedListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonPressedListener listener)
      Unregister the specified pressed listener from gamepad events.
      Parameters:
      identifier - The component identifier for which to remove the listener.
      listener - The listener to remove.
    • removeButtonPressedListener

      public void removeButtonPressedListener(int id, GamepadEvents.GamepadButtonPressedListener listener)
      Unregister the specified released listener from gamepad events.
      Parameters:
      id - The component identifier for which to remove the listener.
      listener - The listener to remove.
    • removeButtonReleasedListener

      public void removeButtonReleasedListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonReleasedListener listener)
      Unregister the specified released listener from gamepad events.
      Parameters:
      identifier - The component identifier for which to remove the listener.
      listener - The listener to remove.
    • removeButtonReleasedListener

      public void removeButtonReleasedListener(int id, GamepadEvents.GamepadButtonReleasedListener listener)
      Unregister the specified released listener from gamepad events.
      Parameters:
      id - The component identifier for which to remove the listener.
      listener - The listener to remove.
    • removePollListener

      public void removePollListener(GamepadEvents.GamepadValueChangedListener listener)
      Unregister the specified poll listener from gamepad events.
      Parameters:
      listener - The listener to remove.
    • removeButtonPressedListener

      public void removeButtonPressedListener(GamepadEvents.GamepadButtonPressedListener listener)
      Unregister the specified pressed listener from gamepad events.
      Parameters:
      listener - The listener to remove.
    • removeButtonReleasedListener

      public void removeButtonReleasedListener(GamepadEvents.GamepadButtonReleasedListener listener)
      Unregister the specified released listener from gamepad events.
      Parameters:
      listener - The listener to remove.
    • clearEventListeners

      public void clearEventListeners()
      Removes all registered event listeners from the Gamepad instance.
    • isButtonPressed

      public abstract boolean isButtonPressed(de.gurkenlabs.input4j.InputComponent.ID buttonId)
      Determines whether the specified Gamepad component is currently pressed. This is useful for button type components.
      Parameters:
      buttonId - The component to check against.
      Returns:
      True if the component is pressed, otherwise false.
    • isButtonPressed

      public abstract boolean isButtonPressed(int buttonId)