Class GamepadEvents
java.lang.Object
de.gurkenlabs.litiengine.input.GamepadEvents
- Direct Known Subclasses:
Gamepad,GamepadManager
The
GamepadEvents class is the engine's implementation for receiving gamepad input events.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis listener interface receives poll events for a gamepad.static interfaceThis listener interface receives pressed events for a gamepad.static interfaceThis listener interface receives released events for a gamepad. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String, Collection<GamepadEvents.GamepadPollListener>> protected final Map<String, Collection<GamepadEvents.GamepadPressedListener>> protected final Map<String, Collection<GamepadEvents.GamepadReleasedListener>> protected final Collection<GamepadEvents.GamepadPollListener> protected final Collection<GamepadEvents.GamepadPressedListener> protected final Collection<GamepadEvents.GamepadReleasedListener> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all registered event listeners from the Gamepad instance.abstract booleanDetermines whether the specified Gamepad component is currently pressed.voidonPoll(GamepadEvents.GamepadPollListener listener) Adds the specified gamepad poll listener to receive events when any component has been polled.voidonPoll(String identifier, GamepadEvents.GamepadPollListener listener) Adds the specified gamepad poll listener to receive events when the component with the defined identifier has been polled.voidAdds the specified gamepad pressed listener to receive events when any component has been pressed.voidonPressed(String identifier, GamepadEvents.GamepadPressedListener listener) Adds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.voidAdds the specified gamepad released listener to receive events when any component has been released.voidonReleased(String identifier, GamepadEvents.GamepadReleasedListener listener) Adds the specified gamepad released listener to receive events when the component with the defined identifier has been released.voidUnregister the specified poll listener from gamepad events.voidremovePollListener(String identifier, GamepadEvents.GamepadPollListener listener) Unregister the specified poll listener from gamepad events.voidUnregister the specified pressed listener from gamepad events.voidremovePressedListener(String identifier, GamepadEvents.GamepadPressedListener listener) Unregister the specified pressed listener from gamepad events.voidUnregister the specified released listener from gamepad events.voidremoveReleasedListener(String identifier, GamepadEvents.GamepadReleasedListener listener) Unregister the specified released listener from gamepad events.
-
Field Details
-
componentPollListeners
-
componentPressedListeners
protected final Map<String,Collection<GamepadEvents.GamepadPressedListener>> componentPressedListeners -
componentReleasedListeners
protected final Map<String,Collection<GamepadEvents.GamepadReleasedListener>> componentReleasedListeners -
pollListeners
-
pressedListeners
-
releasedListeners
-
-
Constructor Details
-
GamepadEvents
protected GamepadEvents()
-
-
Method Details
-
onPoll
Adds the specified gamepad poll listener to receive events when the component with the defined identifier has been polled.- Parameters:
identifier- The component identifier for which to add the listener.listener- The listener to add.
-
removePollListener
Unregister the specified poll listener from gamepad events.- Parameters:
identifier- The component identifier for which to remove the listener.listener- The listener to remove.
-
onPressed
Adds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.- Parameters:
identifier- The component identifier for which to add the listener.listener- The listener to add.
-
removePressedListener
Unregister the specified pressed listener from gamepad events.- Parameters:
identifier- The component identifier for which to remove the listener.listener- The listener to remove.
-
onReleased
Adds the specified gamepad released listener to receive events when the component with the defined identifier has been released.- Parameters:
identifier- The component identifier for which to add the listener.listener- The listener to add.
-
removeReleasedListener
public void removeReleasedListener(String identifier, GamepadEvents.GamepadReleasedListener listener) Unregister the specified released listener from gamepad events.- Parameters:
identifier- The component identifier for which to remove the listener.listener- The listener to remove.
-
onPoll
Adds the specified gamepad poll listener to receive events when any component has been polled.- Parameters:
listener- The listener to add.
-
removePollListener
Unregister the specified poll listener from gamepad events.- Parameters:
listener- The listener to remove.
-
onPressed
Adds the specified gamepad pressed listener to receive events when any component has been pressed.- Parameters:
listener- The listener to add.
-
removePressedListener
Unregister the specified pressed listener from gamepad events.- Parameters:
listener- The listener to remove.
-
onReleased
Adds the specified gamepad released listener to receive events when any component has been released.- Parameters:
listener- The listener to add.
-
removeReleasedListener
Unregister the specified released listener from gamepad events.- Parameters:
listener- The listener to remove.
-
clearEventListeners
public void clearEventListeners()Removes all registered event listeners from the Gamepad instance. -
isPressed
Determines whether the specified Gamepad component is currently pressed. This is useful for button type components.- Parameters:
gamepadComponent- The component to check against.- Returns:
- True if the component is pressed, otherwise false.
- See Also:
-