public final class GamepadManager extends java.lang.Object implements ILaunchable, GamepadEvents
GamepadEvents.GamepadPollListener, GamepadEvents.GamepadPressedListener, GamepadEvents.GamepadReleasedListener| Modifier and Type | Method and Description |
|---|---|
void |
clearEventListeners()
Removes all registered event listeners from the Gamepad instance.
|
Gamepad |
current()
Gets the first gamepad that is currently available.
|
Gamepad |
get(int index)
Gets the gamepad with the specified index if it is still plugged in.
|
java.util.List<Gamepad> |
getAll() |
boolean |
isPressed(java.lang.String gamepadComponent)
Determines whether the specified Gamepad component is currently pressed.
|
void |
onGamepadAdded(java.util.function.Consumer<Gamepad> cons) |
void |
onGamepadRemoved(java.util.function.Consumer<Gamepad> cons) |
void |
onPoll(GamepadEvents.GamepadPollListener listener)
Adds the specified gamepad poll listener to receive events when any component has been polled.
|
void |
onPoll(java.lang.String identifier,
GamepadEvents.GamepadPollListener consumer)
Adds the specified gamepad poll listener to receive events when the component with the defined identifier has been polled.
|
void |
onPressed(GamepadEvents.GamepadPressedListener listener)
Adds the specified gamepad pressed listener to receive events when any component has been pressed.
|
void |
onPressed(java.lang.String identifier,
GamepadEvents.GamepadPressedListener listener)
Adds the specified gamepad pressed listener to receive events when the component with the defined identifier has been pressed.
|
void |
onReleased(GamepadEvents.GamepadReleasedListener listener)
Adds the specified gamepad released listener to receive events when any component has been released.
|
void |
onReleased(java.lang.String identifier,
GamepadEvents.GamepadReleasedListener listener)
Adds the specified gamepad released listener to receive events when the component with the defined identifier has been released.
|
void |
removePollListener(GamepadEvents.GamepadPollListener listener)
Unregister the specified poll listener from gamepad events.
|
void |
removePollListener(java.lang.String identifier,
GamepadEvents.GamepadPollListener listener)
Unregister the specified poll listener from gamepad events.
|
void |
removePressedListener(GamepadEvents.GamepadPressedListener listener)
Unregister the specified pressed listener from gamepad events.
|
void |
removePressedListener(java.lang.String identifier,
GamepadEvents.GamepadPressedListener listener)
Unregister the specified pressed listener from gamepad events.
|
void |
removeReleasedListener(GamepadEvents.GamepadReleasedListener listener)
Unregister the specified released listener from gamepad events.
|
void |
removeReleasedListener(java.lang.String identifier,
GamepadEvents.GamepadReleasedListener listener)
Unregister the specified released listener from gamepad events.
|
void |
start()
Starts the operation of this instance.
|
void |
terminate()
Terminates the operation of this instance.
|
public java.util.List<Gamepad> getAll()
public Gamepad current()
Gamepad instancepublic Gamepad get(int index)
public void onGamepadAdded(java.util.function.Consumer<Gamepad> cons)
public void onGamepadRemoved(java.util.function.Consumer<Gamepad> cons)
public void onPoll(java.lang.String identifier,
GamepadEvents.GamepadPollListener consumer)
GamepadEventsonPoll in interface GamepadEventsidentifier - The component identifier for which to add the listener.consumer - The listener to add.public void removePollListener(java.lang.String identifier,
GamepadEvents.GamepadPollListener listener)
GamepadEventsremovePollListener in interface GamepadEventsidentifier - The component identifier for which to remove the listener.listener - The listener to remove.public void onPressed(java.lang.String identifier,
GamepadEvents.GamepadPressedListener listener)
GamepadEventsonPressed in interface GamepadEventsidentifier - The component identifier for which to add the listener.listener - The listener to add.public void removePressedListener(java.lang.String identifier,
GamepadEvents.GamepadPressedListener listener)
GamepadEventsremovePressedListener in interface GamepadEventsidentifier - The component identifier for which to remove the listener.listener - The listener to remove.public void onReleased(java.lang.String identifier,
GamepadEvents.GamepadReleasedListener listener)
GamepadEventsonReleased in interface GamepadEventsidentifier - The component identifier for which to add the listener.listener - The listener to add.public void removeReleasedListener(java.lang.String identifier,
GamepadEvents.GamepadReleasedListener listener)
GamepadEventsremoveReleasedListener in interface GamepadEventsidentifier - The component identifier for which to remove the listener.listener - The listener to remove.public void onPoll(GamepadEvents.GamepadPollListener listener)
GamepadEventsonPoll in interface GamepadEventslistener - The listener to add.public void removePollListener(GamepadEvents.GamepadPollListener listener)
GamepadEventsremovePollListener in interface GamepadEventslistener - The listener to remove.public void onPressed(GamepadEvents.GamepadPressedListener listener)
GamepadEventsonPressed in interface GamepadEventslistener - The listener to add.public void removePressedListener(GamepadEvents.GamepadPressedListener listener)
GamepadEventsremovePressedListener in interface GamepadEventslistener - The listener to remove.public void onReleased(GamepadEvents.GamepadReleasedListener listener)
GamepadEventsonReleased in interface GamepadEventslistener - The listener to add.public void removeReleasedListener(GamepadEvents.GamepadReleasedListener listener)
GamepadEventsremoveReleasedListener in interface GamepadEventslistener - The listener to remove.public void clearEventListeners()
GamepadEventsclearEventListeners in interface GamepadEventspublic void start()
ILaunchablestart in interface ILaunchablepublic void terminate()
ILaunchableterminate in interface ILaunchablepublic boolean isPressed(java.lang.String gamepadComponent)
GamepadEventsisPressed in interface GamepadEventsgamepadComponent - The component to check against.Gamepad.Buttons,
Gamepad.Xbox