Package de.gurkenlabs.litiengine.input
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 classstatic classstatic classstatic classstatic classNested 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 TypeMethodDescriptionfloatGets the deadzone for any axis components on this gamepad.intgetId()Gets the unique id of this gamepad by which it is identified.getName()Gets the name of this gamepad.floatgetPollData(String component) Gets the poll data for the specified component on this gamepad.floatGets the deadzone for any trigger components on this gamepad.getType()booleanhasComponent(String gamepadComponent) booleanDetermines whether the specified Gamepad component is currently pressed.voidsetAxisDeadzone(float axisDeadzone) Sets the deadzone for any axis components on this gamepad.voidsetTriggerDeadzone(float triggerDeadzone) Sets the deadzone for any trigger components on this gamepad.voidtoString()voidupdate()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
Gets the name of this gamepad.- Returns:
- The name of this gamepad.
-
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:GamepadEventsDetermines whether the specified Gamepad component is currently pressed. This is useful for button type components.- Specified by:
isPressedin 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:IUpdateableThis 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:
updatein interfaceIUpdateable- See Also:
-
toString
-
getType
-
setType
-