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
The axes and the RB/LB vertical movement all go through the same smoothing filter, driven by
the controls.gamepad.smoothing setting, so the navigation ramps in and out instead of
responding to every controller sample as it arrives.
-
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 TypeMethodDescriptionvoidactivate()Activate the listener.booleanaxisMoved(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) voidDeactivate the listener.booleanpollAxes()Polls the axes.booleanPolls the buttons.voidupdate()Update the listener.Methods inherited from class AbstractGamepadListener
anyPressed, anyPressed, applyZeroPoint, connected, disconnected, getMappings, isActive, isKeyPressed, isKeyPressed, notify, setMappingsModifier and TypeMethodDescriptionbooleananyPressed(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) 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.
-
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
-
update
public void update()Description copied from interface:IInputListenerUpdate the listener.- Specified by:
updatein interfaceIInputListener- Overrides:
updatein classAbstractGamepadListener
-
activate
public void activate()Description copied from interface:IInputListenerActivate the listener.- Specified by:
activatein interfaceIInputListener- Overrides:
activatein classAbstractGamepadListener
-
deactivate
public void deactivate()Description copied from interface:IInputListenerDeactivate the listener.- Specified by:
deactivatein interfaceIInputListener- Overrides:
deactivatein 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.
-