Class Gamepad
java.lang.Object
de.gurkenlabs.litiengine.input.GamepadEvents
de.gurkenlabs.litiengine.input.Gamepad
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
Nested classes/interfaces inherited from class de.gurkenlabs.litiengine.input.GamepadEvents
GamepadEvents.GamepadPollListener, GamepadEvents.GamepadPressedListener, GamepadEvents.GamepadReleasedListener
-
Field Summary
Fields inherited from class de.gurkenlabs.litiengine.input.GamepadEvents
componentPollListeners, componentPressedListeners, componentReleasedListeners, pollListeners, pressedListeners, releasedListeners
-
Method Summary
Modifier and TypeMethodDescriptionfloat
Gets the deadzone for any axis components on this gamepad.int
getId()
Gets the unique id of this gamepad by which it is identified.getName()
Gets the name of this gamepad.float
getPollData
(String component) Gets the poll data for the specified component on this gamepad.float
Gets the deadzone for any trigger components on this gamepad.getType()
boolean
hasComponent
(String gamepadComponent) boolean
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.void
toString()
void
update()
This method is called by the game loop on all objects that are attached to the loop.Methods inherited from class de.gurkenlabs.litiengine.input.GamepadEvents
clearEventListeners, onPoll, onPoll, onPressed, onPressed, onReleased, onReleased, removePollListener, removePollListener, removePressedListener, removePressedListener, removeReleasedListener, removeReleasedListener
-
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
-
getPollData
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:
-
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:
-
isPressed
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 classGamepadEvents
- Parameters:
gamepadComponent
- The component to check against.- Returns:
- True if the component is pressed, otherwise false.
- See Also:
-
getComponents
-
hasComponent
-
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:
-
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:
-
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 theClientConfiguration
.- Specified by:
update
in interfaceIUpdateable
- See Also:
-
toString
-
getType
-
setType
-