Class DefaultJoystickAxis

All Implemented Interfaces:
Direct Known Subclasses:

public class DefaultJoystickAxis extends Object implements JoystickAxis
Default implementation of the JoystickAxis interface.
  • Constructor Details

    • DefaultJoystickAxis

      public DefaultJoystickAxis(InputManager inputManager, Joystick parent, int axisIndex, String name, String logicalId, boolean isAnalog, boolean isRelative, float deadZone)
      Creates a new joystick axis instance. Only used internally.
      inputManager - (alias created)
      parent - (alias created)
      axisIndex - index for the new axis
      name - name for the new axis
      logicalId - logical identifier for the new axis
      isAnalog - true→continuous range, false→discrete values
      isRelative - true→presents relative values
      deadZone - the radius of the dead zone
  • Method Details

    • assignAxis

      public void assignAxis(String positiveMapping, String negativeMapping)
      Assign the mappings to receive events from the given joystick axis.
      Specified by:
      assignAxis in interface JoystickAxis
      positiveMapping - The mapping to receive events when the axis is negative
      negativeMapping - The mapping to receive events when the axis is positive
    • getJoystick

      public Joystick getJoystick()
      Returns the joystick to which this axis object belongs.
      Specified by:
      getJoystick in interface JoystickAxis
      the pre-existing instance
    • getName

      public String getName()
      Returns the name of this joystick.
      Specified by:
      getName in interface JoystickAxis
      the name of this joystick.
    • getLogicalId

      public String getLogicalId()
      Returns the logical identifier of this joystick axis.
      Specified by:
      getLogicalId in interface JoystickAxis
      the logical identifier of this joystick.
    • getAxisId

      public int getAxisId()
      Returns the axisId of this joystick axis.
      Specified by:
      getAxisId in interface JoystickAxis
      the axisId of this joystick axis.
    • isAnalog

      public boolean isAnalog()
      Returns true if this is an analog axis, meaning the values are a continuous range instead of 1, 0, and -1.
      Specified by:
      isAnalog in interface JoystickAxis
      true if analog, otherwise false
    • isRelative

      public boolean isRelative()
      Returns true if this axis presents relative values.
      Specified by:
      isRelative in interface JoystickAxis
      true if relative, otherwise false
    • getDeadZone

      public float getDeadZone()
      Returns the suggested dead zone for this axis. Values less than this can be safely ignored.
      Specified by:
      getDeadZone in interface JoystickAxis
      the radius of the dead zone
    • setDeadZone

      public void setDeadZone(float f)
      Sets/overrides the dead zone for this axis. This indicates that values within +/- deadZone should be ignored.
      f - the desired radius
    • toString

      public String toString()
      toString in class Object