Class Gamepad

java.lang.Object
de.gurkenlabs.litiengine.input.GamepadEvents
de.gurkenlabs.litiengine.input.Gamepad
All Implemented Interfaces:
IUpdateable

public final class Gamepad
extends GamepadEvents
implements IUpdateable
The Gamepad class is designed as a wrapper implementation for any gamepad input that provides events and information about player input via gamepad.
See Also:
Controller
  • Method Details

    • getId

      public int getId()
      Gets the unique id of this gamepad by which it is identified.
      Returns:
      The unique id of this gamepad.
    • getName

      public java.lang.String getName()
      Gets the name of this gamepad.
      Returns:
      The name of this gamepad.
    • getPollData

      public float getPollData​(java.lang.String component)
      Gets the poll data for the specified component on this gamepad.

      Returns the data from the last time the control has been polled.If this axis is a button, the value returned will be either 0.0f or 1.0f.If this axis is normalized, the value returned will be between -1.0f and1.0f.

      Parameters:
      component - The component to retrieve the poll data for.
      Returns:
      The data from the last time the specified component has been polled; 0 if this gamepad doesn't provide the requested component.
    • getAxisDeadzone

      public float getAxisDeadzone()
      Gets the deadzone for any axis components on this gamepad.

      A deadzone defines the poll value at which the events of this gamepad are not being triggered. This is useful to smooth out controller input and not react to idle noise.

      Returns:
      The axis deadzone for this component.
      See Also:
      setAxisDeadzone(float)
    • getTriggerDeadzone

      public float getTriggerDeadzone()
      Gets the deadzone for any trigger components on this gamepad.

      A deadzone defines the poll value at which the events of this gamepad are not being triggered. This is useful to smooth out controller input and not react to idle noise.

      Returns:
      The trigger deadzone for this gamepad.
      See Also:
      setTriggerDeadzone(float)
    • isPressed

      public boolean isPressed​(java.lang.String gamepadComponent)
      Description copied from class: GamepadEvents
      Determines whether the specified Gamepad component is currently pressed. This is useful for button type components.
      Specified by:
      isPressed in class GamepadEvents
      Parameters:
      gamepadComponent - The component to check against.
      Returns:
      True if the component is pressed, otherwise false.
      See Also:
      Gamepad.Buttons, Gamepad.Xbox
    • setAxisDeadzone

      public void setAxisDeadzone​(float axisDeadzone)
      Sets the deadzone for any axis components on this gamepad.
      Parameters:
      axisDeadzone - The axis deadzone for this gamepad.
      See Also:
      getAxisDeadzone()
    • setTriggerDeadzone

      public void setTriggerDeadzone​(float triggerDeadzone)
      Sets the deadzone for any trigger components on this gamepad.
      Parameters:
      triggerDeadzone - The trigger deadzone for this gamepad.
      See Also:
      getTriggerDeadzone()
    • update

      public void update()
      Description copied from interface: IUpdateable
      This method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using the ClientConfiguration.
      Specified by:
      update in interface IUpdateable
      See Also:
      ClientConfiguration.setMaxFps(int)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object