Package de.gurkenlabs.litiengine.input
Class GamepadManager
java.lang.Object
de.gurkenlabs.litiengine.input.GamepadEvents
de.gurkenlabs.litiengine.input.GamepadManager
- All Implemented Interfaces:
ILaunchable
public final class GamepadManager
extends GamepadEvents
implements ILaunchableThe
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.
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGamepadManager.GamepadAddedListenerThis listener interface receives events when gamepads gets added.static interfaceGamepadManager.GamepadRemovedListenerThis listener interface receives events when gamepads gets removed.Nested classes/interfaces inherited from class de.gurkenlabs.litiengine.input.GamepadEvents
GamepadEvents.GamepadPollListener, GamepadEvents.GamepadPressedListener, GamepadEvents.GamepadReleasedListenerField Summary
Fields inherited from class de.gurkenlabs.litiengine.input.GamepadEvents
componentPollListeners, componentPressedListeners, componentReleasedListeners, pollListeners, pressedListeners, releasedListenersMethod Summary
Modifier and Type Method Description Gamepadcurrent()Gets the first gamepad that is currently available.Gamepadget(int index)Gets the gamepad by the index within the gamepad list.java.util.List<Gamepad>getAll()Gets all gamepads that are currently available.GamepadgetById(int id)Gets the gamepad with the specified id if it is still plugged in.booleanisPressed(java.lang.String gamepadComponent)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.voidonRemoved(GamepadManager.GamepadRemovedListener listener)Adds the specified gamepad removed listener to receive events when gamepads are removed.voidremoveAddedListener(GamepadManager.GamepadAddedListener listener)Unregister the specified added listener from this instance.voidremoveRemovedListener(GamepadManager.GamepadRemovedListener listener)Unregister the specified removed listener from this instance.voidstart()DON'T CALL THIS EXPLICITLY! THE LITIENGINE WILL MANAGE THE LIFECYCLE OF THIS INSTANCE.voidterminate()DON'T CALL THIS EXPLICITLY! THE LITIENGINE WILL MANAGE THE LIFECYCLE OF THIS INSTANCE.Methods inherited from class de.gurkenlabs.litiengine.input.GamepadEvents
clearEventListeners, onPoll, onPoll, onPressed, onPressed, onReleased, onReleased, removePollListener, removePollListener, removePressedListener, removePressedListener, removeReleasedListener, removeReleasedListener
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
Gets all gamepads that are currently available.current
Gets the first gamepad that is currently available.get
Gets the gamepad by the index within the gamepad list.getById
Gets the gamepad with the specified id if it is still plugged in. After re-plugging a controller while the game is running, its id might change.isPressed
public boolean isPressed(java.lang.String gamepadComponent)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:
Gamepad.Buttons,Gamepad.Xbox
start
public void start()DON'T CALL THIS EXPLICITLY! THE LITIENGINE WILL MANAGE THE LIFECYCLE OF THIS INSTANCE.- Specified by:
startin interfaceILaunchable
terminate
public void terminate()DON'T CALL THIS EXPLICITLY! THE LITIENGINE WILL MANAGE THE LIFECYCLE OF THIS INSTANCE.- Specified by:
terminatein interfaceILaunchable
