Interface Joystick

All Known Implementing Classes:
AbstractJoystick, AndroidJoystickJoyInput14.AndroidJoystick, AndroidSensorJoyInput.AndroidSensorJoystick, GlfwJoystickInput.GlfwJoystick, JInputJoyInput.JInputJoystick

public interface Joystick
A joystick represents a single joystick that is installed in the system.
  • Method Details

    • rumble

      void rumble(float amount)
      Rumbles the joystick for the given amount/magnitude.
      Parameters:
      amount - The amount to rumble. Should be between 0 and 1.
    • assignButton

      @Deprecated void assignButton(String mappingName, int buttonId)
      Deprecated.
      Use JoystickButton.assignButton() instead.
      Assign the mapping name to receive events from the given button index on the joystick.
      Parameters:
      mappingName - The mapping to receive joystick button events.
      buttonId - The button index.
      See Also:
    • assignAxis

      @Deprecated void assignAxis(String positiveMapping, String negativeMapping, int axisId)
      Deprecated.
      Use JoystickAxis.assignAxis() instead.
      Assign the mappings to receive events from the given joystick axis.
      Parameters:
      positiveMapping - The mapping to receive events when the axis is negative
      negativeMapping - The mapping to receive events when the axis is positive
      axisId - The axis index.
      See Also:
    • getAxis

      JoystickAxis getAxis(String logicalId)
      Returns the JoystickAxis with the specified logical ID.
      Parameters:
      logicalId - The id of the axis to search for as returned by JoystickAxis.getLogicalId().
      Returns:
      the pre-existing instance, or null if not found
    • getAxes

      List<JoystickAxis> getAxes()
      Returns a read-only list of all joystick axes for this Joystick.
      Returns:
      an unmodifiable list of pre-existing instances
    • getButton

      JoystickButton getButton(String logicalId)
      Returns the JoystickButton with the specified logical ID.
      Parameters:
      logicalId - The id of the axis to search for as returned by JoystickButton.getLogicalId().
      Returns:
      the pre-existing instance, or null if not found
    • getButtons

      List<JoystickButton> getButtons()
      Returns a read-only list of all joystick buttons for this Joystick.
      Returns:
      an unmodifiable list of pre-existing instances
    • getXAxis

      JoystickAxis getXAxis()
      Returns the X axis for this joystick.

      E.g. for most gamepads, the left control stick X axis will be returned.

      Returns:
      the pre-existing instance
      See Also:
    • getYAxis

      JoystickAxis getYAxis()
      Returns the Y axis for this joystick.

      E.g. for most gamepads, the left control stick Y axis will be returned.

      Returns:
      the pre-existing instance
      See Also:
    • getPovXAxis

      JoystickAxis getPovXAxis()
      Returns the POV X axis for this joystick. This is a convenience axis providing an x-axis subview of the HAT axis.
      Returns:
      the pre-existing instance
      See Also:
    • getPovYAxis

      JoystickAxis getPovYAxis()
      Returns the POV Y axis for this joystick. This is a convenience axis providing a y-axis subview of the HAT axis.
      Returns:
      the pre-existing instance
      See Also:
    • getXAxisIndex

      int getXAxisIndex()
      Gets the index number for the X axis on the joystick.

      E.g. for most gamepads, the left control stick X axis will be returned.

      Returns:
      The axis index for the X axis for this joystick.
      See Also:
    • getYAxisIndex

      int getYAxisIndex()
      Gets the index number for the Y axis on the joystick.

      E.g. for most gamepads, the left control stick Y axis will be returned.

      Returns:
      The axis index for the Y axis for this joystick.
      See Also:
    • getAxisCount

      int getAxisCount()
      Returns the number of axes on this joystick.
      Returns:
      the number of axes on this joystick.
    • getButtonCount

      int getButtonCount()
      Returns the number of buttons on this joystick.
      Returns:
      the number of buttons on this joystick.
    • getName

      String getName()
      Returns the name of this joystick.
      Returns:
      the name of this joystick.
    • getJoyId

      int getJoyId()
      Returns the joyId of this joystick.
      Returns:
      the joyId of this joystick.