Class Gamepad

java.lang.Object
rosequartz.input.Gamepad
Direct Known Subclasses:
NullGamepad

public class Gamepad extends Object
Represents a physical gamepad.
  • Method Details

    • getName

      public String getName()
      Gets the name of the gamepad.
      Returns:
      gamepad name
    • hasButton

      public boolean hasButton(Gamepad.Button b)
      Gets if the gamepad has a button.
      Parameters:
      b - button to check
      Returns:
      gamepad has button
    • getButton

      public boolean getButton(Gamepad.Button b)
      Gets if a button is currently pressed. If the button does not exist, it returns false.
      Parameters:
      b - button to check
      Returns:
      button pressed
    • hasAxis

      public boolean hasAxis(Gamepad.Axis a)
      Gets if the gamepad has an axis.
      Parameters:
      a - axis to check
      Returns:
      gamepad has axis
    • getAxis

      public float getAxis(Gamepad.Axis a)
      Gets the value of an axis. If the axis does not exist, it returns 0.
      Parameters:
      a - axis to check
      Returns:
      axis value
    • getAxes

      public Vec2 getAxes(Gamepad.Axis x, Gamepad.Axis y)
      Gets the value of two axes and puts them into a vec2. If an axis does not exist, it puts 0.
      Parameters:
      x - axis for value x
      y - axis for value y
      Returns:
      axis value
    • isConnected

      public boolean isConnected()
      Gets if the gamepad is still connected.
      Returns:
      gamepad connected