Class GamepadManager
java.lang.Object
de.gurkenlabs.litiengine.input.GamepadEvents
de.gurkenlabs.litiengine.input.GamepadManager
The GamepadManager provides access to all gamepad input devices.
Gamepads don't need to be added explicitly, the manager supports hot-plugging at runtime and will auto-detect any added/removed gamepads.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis listener interface receives events when gamepads gets added.static interfaceThis listener interface receives events when gamepads gets removed.Nested classes/interfaces inherited from class GamepadEvents
GamepadEvents.GamepadButtonPressedListener, GamepadEvents.GamepadButtonReleasedListener, GamepadEvents.GamepadValueChangedListener -
Field Summary
Fields inherited from class GamepadEvents
componentPollListeners, componentPressedListeners, componentReleasedListeners, pollListeners, pressedListeners, releasedListeners -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all registered event listeners from the Gamepad instance.current()Gets the first gamepad that is currently available.get(int index) Gets the gamepad by the index within the gamepad list.getAll()Gets all gamepads that are currently available.Gets the gamepad with the specified id if it is still plugged in.booleanisButtonPressed(int buttonId) booleanisButtonPressed(de.gurkenlabs.input4j.InputComponent.ID buttonId) Determines whether the specified Gamepad component is currently pressed.voidonAdded(GamepadManager.GamepadAddedListener listener) Adds the specified gamepad added listener to receive events when gamepads are added.voidonButtonPressed(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonPressedListener listener) Adds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.voidAdds the specified gamepad pressed listener to receive events when any component has been pressed.voidonButtonReleased(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonReleasedListener listener) Adds the specified gamepad released listener to receive events when the component with the defined identifier has been released.voidAdds the specified gamepad released listener to receive events when any component has been released.voidAdds the specified gamepad removed listener to receive events when gamepads are removed.voidonValueChanged(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadValueChangedListener listener) Adds the specified gamepad poll listener to receive events when the component with the defined identifier has been polled.voidAdds the specified gamepad poll listener to receive events when any component has been polled.voidUnregister the specified added listener from this instance.voidremoveButtonPressedListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonPressedListener listener) Unregister the specified pressed listener from gamepad events.voidUnregister the specified pressed listener from gamepad events.voidremoveButtonReleasedListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonReleasedListener listener) Unregister the specified released listener from gamepad events.voidUnregister the specified released listener from gamepad events.voidremovePollListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadValueChangedListener listener) Unregister the specified poll listener from gamepad events.voidUnregister the specified poll listener from gamepad events.voidUnregister the specified removed listener from this instance.Methods inherited from class GamepadEvents
onButtonPressed, onButtonReleased, removeButtonPressedListener, removeButtonReleasedListener
-
Method Details
-
onAdded
Adds the specified gamepad added listener to receive events when gamepads are added.- Parameters:
listener- The listener to add.
-
removeAddedListener
Unregister the specified added listener from this instance.- Parameters:
listener- The listener to remove.
-
onRemoved
Adds the specified gamepad removed listener to receive events when gamepads are removed.- Parameters:
listener- The listener to add.
-
removeRemovedListener
Unregister the specified removed listener from this instance.- Parameters:
listener- The listener to remove.
-
getAll
-
current
-
get
-
getById
-
onValueChanged
Description copied from class:GamepadEventsAdds the specified gamepad poll listener to receive events when any component has been polled.- Overrides:
onValueChangedin classGamepadEvents- Parameters:
listener- The listener to add.
-
onButtonPressed
Description copied from class:GamepadEventsAdds the specified gamepad pressed listener to receive events when any component has been pressed.- Overrides:
onButtonPressedin classGamepadEvents- Parameters:
listener- The listener to add.
-
onButtonReleased
Description copied from class:GamepadEventsAdds the specified gamepad released listener to receive events when any component has been released.- Overrides:
onButtonReleasedin classGamepadEvents- Parameters:
listener- The listener to add.
-
onValueChanged
public void onValueChanged(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadValueChangedListener listener) Description copied from class:GamepadEventsAdds the specified gamepad poll listener to receive events when the component with the defined identifier has been polled.- Overrides:
onValueChangedin classGamepadEvents- Parameters:
identifier- The component identifier for which to add the listener.listener- The listener to add.
-
onButtonPressed
public void onButtonPressed(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonPressedListener listener) Description copied from class:GamepadEventsAdds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.- Overrides:
onButtonPressedin classGamepadEvents- Parameters:
identifier- The component identifier for which to add the listener.listener- The listener to add.
-
onButtonReleased
public void onButtonReleased(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonReleasedListener listener) Description copied from class:GamepadEventsAdds the specified gamepad released listener to receive events when the component with the defined identifier has been released.- Overrides:
onButtonReleasedin classGamepadEvents- Parameters:
identifier- The component identifier for which to add the listener.listener- The listener to add.
-
clearEventListeners
public void clearEventListeners()Description copied from class:GamepadEventsRemoves all registered event listeners from the Gamepad instance.- Overrides:
clearEventListenersin classGamepadEvents
-
isButtonPressed
public boolean isButtonPressed(de.gurkenlabs.input4j.InputComponent.ID buttonId) Description copied from class:GamepadEventsDetermines whether the specified Gamepad component is currently pressed. This is useful for button type components.- Specified by:
isButtonPressedin classGamepadEvents- Parameters:
buttonId- The component to check against.- Returns:
- True if the component is pressed, otherwise false.
-
isButtonPressed
public boolean isButtonPressed(int buttonId) - Specified by:
isButtonPressedin classGamepadEvents
-
removePollListener
public void removePollListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadValueChangedListener listener) Description copied from class:GamepadEventsUnregister the specified poll listener from gamepad events.- Overrides:
removePollListenerin classGamepadEvents- Parameters:
identifier- The component identifier for which to remove the listener.listener- The listener to remove.
-
removeButtonPressedListener
public void removeButtonPressedListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonPressedListener listener) Description copied from class:GamepadEventsUnregister the specified pressed listener from gamepad events.- Overrides:
removeButtonPressedListenerin classGamepadEvents- Parameters:
identifier- The component identifier for which to remove the listener.listener- The listener to remove.
-
removeButtonReleasedListener
public void removeButtonReleasedListener(de.gurkenlabs.input4j.InputComponent.ID identifier, GamepadEvents.GamepadButtonReleasedListener listener) Description copied from class:GamepadEventsUnregister the specified released listener from gamepad events.- Overrides:
removeButtonReleasedListenerin classGamepadEvents- Parameters:
identifier- The component identifier for which to remove the listener.listener- The listener to remove.
-
removePollListener
Description copied from class:GamepadEventsUnregister the specified poll listener from gamepad events.- Overrides:
removePollListenerin classGamepadEvents- Parameters:
listener- The listener to remove.
-
removeButtonPressedListener
Description copied from class:GamepadEventsUnregister the specified pressed listener from gamepad events.- Overrides:
removeButtonPressedListenerin classGamepadEvents- Parameters:
listener- The listener to remove.
-
removeButtonReleasedListener
Description copied from class:GamepadEventsUnregister the specified released listener from gamepad events.- Overrides:
removeButtonReleasedListenerin classGamepadEvents- Parameters:
listener- The listener to remove.
-