Class MainGamepadListener
java.lang.Object
gaiasky.input.AbstractGamepadListener
gaiasky.input.MainGamepadListener
- All Implemented Interfaces:
com.badlogic.gdx.controllers.ControllerListener, IObserver, IInputListener
Implements the gamepad/game controller listener in default mode.
The default mappings go like this:
- X - visibility of labels
- Y - visibility of orbits
- A - hold to speed up camera
- B - visibility of asteroids
- D-pad right - start time
- D-pad left - stop time
- Start - show preferences (gamepad menu)
- Select - show quit window
- RB - move vertically up
- LB - move vertically down
- Axis R - movement
- Axis L - rotate view (free mode), rotate around object (focus mode)
- ZR - roll right
- ZL - roll left
-
Field Summary
Fields inherited from class AbstractGamepadListener
active, axisEventDelay, axisPollDelay, buttonPollDelay, em, lastAxisEvtTime, lastButtonPollTime, lastControllerUsed, mappings, MIN_ZERO_POINTModifier and TypeFieldDescriptionprotected final AtomicBooleanIs this listener active?protected longDelay between axis events.protected longDelay between axis poll operations.protected longDelay between button poll operations.protected final EventManagerReference to the global event manager.protected longLast axis event time.protected longLast button poll time.protected com.badlogic.gdx.controllers.ControllerReference to the last gaming controller that registered an input.protected IGamepadMappingsGamepad mappings instance.protected static final float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaxisMoved(com.badlogic.gdx.controllers.Controller controller, int axisCode, float value) booleanbuttonDown(com.badlogic.gdx.controllers.Controller controller, int buttonCode) booleanbuttonUp(com.badlogic.gdx.controllers.Controller controller, int buttonCode) booleanpollAxes()Polls the axes.booleanPolls the buttons.Methods inherited from class AbstractGamepadListener
activate, anyPressed, anyPressed, applyZeroPoint, connected, deactivate, disconnected, getMappings, isActive, isKeyPressed, isKeyPressed, notify, setMappings, updateModifier and TypeMethodDescriptionvoidactivate()Activate the listener.booleananyPressed(int... buttonCodes) Returns true if any of the buttons are pressed in the last controller used.booleananyPressed(com.badlogic.gdx.controllers.Controller controller, int... buttonCodes) Returns true if any of the buttons are pressed in the given controller.protected doubleapplyZeroPoint(double value) Zero-point function for the axes.voidconnected(com.badlogic.gdx.controllers.Controller controller) voidDeactivate the listener.voiddisconnected(com.badlogic.gdx.controllers.Controller controller) Get the mappings instance.booleanisActive()Is this listener active?booleanisKeyPressed(int buttonCode) Checks whether the button with the given code is pressed in the last controller used.booleanisKeyPressed(com.badlogic.gdx.controllers.Controller controller, int buttonCode) Returns if the given button in the given controller is pressed.voidEvent notification call.voidsetMappings(IGamepadMappings mappings) Sets the mappings.voidupdate()Update the listener.
-
Constructor Details
-
MainGamepadListener
-
-
Method Details
-
buttonDown
public boolean buttonDown(com.badlogic.gdx.controllers.Controller controller, int buttonCode) - Specified by:
buttonDownin interfacecom.badlogic.gdx.controllers.ControllerListener- Overrides:
buttonDownin classAbstractGamepadListener
-
buttonUp
public boolean buttonUp(com.badlogic.gdx.controllers.Controller controller, int buttonCode) - Specified by:
buttonUpin interfacecom.badlogic.gdx.controllers.ControllerListener- Overrides:
buttonUpin classAbstractGamepadListener
-
axisMoved
public boolean axisMoved(com.badlogic.gdx.controllers.Controller controller, int axisCode, float value) - Specified by:
axisMovedin interfacecom.badlogic.gdx.controllers.ControllerListener- Overrides:
axisMovedin classAbstractGamepadListener
-
pollAxes
public boolean pollAxes()Description copied from class:AbstractGamepadListenerPolls the axes.- Specified by:
pollAxesin classAbstractGamepadListener- Returns:
- True if the axes were processed, false otherwise.
-
pollButtons
public boolean pollButtons()Description copied from class:AbstractGamepadListenerPolls the buttons.- Specified by:
pollButtonsin classAbstractGamepadListener- Returns:
- True if the buttons were processed, false otherwise.
-