Class NullGamepad

java.lang.Object
rosequartz.input.Gamepad
rosequartz.input.NullGamepad

public final class NullGamepad extends Gamepad
Represents a gamepad that does not exist. Used as a placeholder for when no gamepad is connected, but a gamepad is expected. This allows the return value to behave like a gamepad that does nothing, instead of crashing.
See Also:
InputManager.mainGamepad()
  • Constructor Details

    • NullGamepad

      public NullGamepad()
  • Method Details

    • getName

      public String getName()
      Gets the name of the gamepad.
      Overrides:
      getName in class Gamepad
      Returns:
      empty string
    • hasButton

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

      public boolean getButton(Gamepad.Button b)
      Gets if a button is currently pressed. Always returns false.
      Overrides:
      getButton in class Gamepad
      Parameters:
      b - button to check
      Returns:
      false
    • hasAxis

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

      public float getAxis(Gamepad.Axis a)
      Gets the value of an axis. Always returns 0.
      Overrides:
      getAxis in class Gamepad
      Parameters:
      a - axis to check
      Returns:
      0
    • isConnected

      public boolean isConnected()
      Gets if the gamepad is still connected. Always returns false.
      Overrides:
      isConnected in class Gamepad
      Returns:
      false