public final class Gamepad extends GamepadEvents implements IUpdateable
Gamepad
class is designed as a wrapper implementation for any gamepad input that provides events and information
about player input via gamepad.Controller
Modifier and Type | Class and Description |
---|---|
static class |
Gamepad.Axis |
static class |
Gamepad.Buttons |
static class |
Gamepad.DPad |
static class |
Gamepad.Xbox |
GamepadEvents.GamepadPollListener, GamepadEvents.GamepadPressedListener, GamepadEvents.GamepadReleasedListener
componentPollListeners, componentPressedListeners, componentReleasedListeners, pollListeners, pressedListeners, releasedListeners
Modifier and Type | Method and Description |
---|---|
float |
getAxisDeadzone()
Gets the deadzone for any axis components on this gamepad.
|
int |
getIndex()
Gets the unique index of this gamepad by which it is identified.
|
java.lang.String |
getName()
Gets the name of this gamepad.
|
float |
getPollData(java.lang.String component)
Gets the poll data for the specified component on this gamepad.
|
float |
getTriggerDeadzone()
Gets the deadzone for any trigger components on this gamepad.
|
boolean |
isPressed(java.lang.String gamepadComponent)
Determines whether the specified Gamepad component is currently pressed.
|
void |
setAxisDeadzone(float axisDeadzone)
Sets the deadzone for any axis components on this gamepad.
|
void |
setTriggerDeadzone(float triggerDeadzone)
Sets the deadzone for any trigger components on this gamepad.
|
java.lang.String |
toString() |
void |
update()
This method is called by the game loop on all objects that are attached to the loop.
|
clearEventListeners, onPoll, onPoll, onPressed, onPressed, onReleased, onReleased, removePollListener, removePollListener, removePressedListener, removePressedListener, removeReleasedListener, removeReleasedListener
public int getIndex()
public java.lang.String getName()
public float getPollData(java.lang.String component)
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.
component
- The component to retrieve the poll data for.public float getAxisDeadzone()
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.
setAxisDeadzone(float)
public float getTriggerDeadzone()
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.
setTriggerDeadzone(float)
public boolean isPressed(java.lang.String gamepadComponent)
GamepadEvents
isPressed
in class GamepadEvents
gamepadComponent
- The component to check against.Gamepad.Buttons
,
Gamepad.Xbox
public void setAxisDeadzone(float axisDeadzone)
axisDeadzone
- The axis deadzone for this gamepad.getAxisDeadzone()
public void setTriggerDeadzone(float triggerDeadzone)
triggerDeadzone
- The trigger deadzone for this gamepad.getTriggerDeadzone()
public void update()
IUpdateable
ClientConfiguration
.update
in interface IUpdateable
ClientConfiguration.setMaxFps(int)
public java.lang.String toString()
toString
in class java.lang.Object