public final class GamepadManager extends GamepadEvents implements ILaunchable
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.
Modifier and Type | Class and Description |
---|---|
static interface |
GamepadManager.GamepadAddedListener
This listener interface receives events when gamepads gets added.
|
static interface |
GamepadManager.GamepadRemovedListener
This listener interface receives events when gamepads gets removed.
|
GamepadEvents.GamepadPollListener, GamepadEvents.GamepadPressedListener, GamepadEvents.GamepadReleasedListener
componentPollListeners, componentPressedListeners, componentReleasedListeners, pollListeners, pressedListeners, releasedListeners
Modifier and Type | Method and Description |
---|---|
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()
Gets all gamepads that are currently available.
|
boolean |
isPressed(java.lang.String gamepadComponent)
Determines whether the specified Gamepad component is currently pressed.
|
void |
onAdded(GamepadManager.GamepadAddedListener listener)
Adds the specified gamepad added listener to receive events when gamepads are added.
|
void |
onRemoved(GamepadManager.GamepadRemovedListener listener)
Adds the specified gamepad removed listener to receive events when gamepads are removed.
|
void |
removeAddedListener(GamepadManager.GamepadAddedListener listener)
Unregister the specified added listener from this instance.
|
void |
removeRemovedListener(GamepadManager.GamepadRemovedListener listener)
Unregister the specified removed listener from this instance.
|
void |
start()
DON'T CALL THIS EXPLICITLY! THE LITIENGINE WILL MANAGE THE LIFECYCLE OF THIS INSTANCE.
|
void |
terminate()
DON'T CALL THIS EXPLICITLY! THE LITIENGINE WILL MANAGE THE LIFECYCLE OF THIS INSTANCE.
|
clearEventListeners, onPoll, onPoll, onPressed, onPressed, onReleased, onReleased, removePollListener, removePollListener, removePressedListener, removePressedListener, removeReleasedListener, removeReleasedListener
public void onAdded(GamepadManager.GamepadAddedListener listener)
listener
- The listener to add.public void removeAddedListener(GamepadManager.GamepadAddedListener listener)
listener
- The listener to remove.public void onRemoved(GamepadManager.GamepadRemovedListener listener)
listener
- The listener to add.public void removeRemovedListener(GamepadManager.GamepadRemovedListener listener)
listener
- The listener to remove.public java.util.List<Gamepad> getAll()
public Gamepad current()
public Gamepad get(int index)
public boolean isPressed(java.lang.String gamepadComponent)
GamepadEvents
isPressed
in class GamepadEvents
gamepadComponent
- The component to check against.Gamepad.Buttons
,
Gamepad.Xbox
public void start()
start
in interface ILaunchable
public void terminate()
terminate
in interface ILaunchable