Class GuiGamepadListener
java.lang.Object
gaiasky.input.AbstractGamepadListener
gaiasky.input.GuiGamepadListener
- All Implemented Interfaces:
com.badlogic.gdx.controllers.ControllerListener, IObserver, IInputListener
- Direct Known Subclasses:
ScreenGamepadListener
A gamepad listener for GUI elements like windows and panes.
-
Field Summary
FieldsFields 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
ConstructorsModifierConstructorDescriptionprotectedGuiGamepadListener(IGamepadMappings mappings, com.badlogic.gdx.scenes.scene2d.Stage stage) protectedGuiGamepadListener(String mappingsFile, com.badlogic.gdx.scenes.scene2d.Stage stage) -
Method Summary
Modifier and TypeMethodDescriptionvoidBy default, the main action acts on the keyboard focus actor by firing a change event or checking it, if it is a checkbox.booleanaxisMoved(com.badlogic.gdx.controllers.Controller controller, int axisCode, float value) abstract voidback()booleanbuttonDown(com.badlogic.gdx.controllers.Controller controller, int buttonCode) com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Group> protected voidleftTrigger(float value) The left trigger does: Move sliders left. Move selection in select boxes up.protected voidleftTrigger(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) voidmoveDown()Moves the focus down.voidmoveFocusVertical(boolean up) abstract voidmoveLeft()abstract voidvoidmoveUp()Moves the focus up.booleanpollAxes()Polls the axes.booleanPolls the buttons.voidrightStickHorizontal(float value) By default, the horizontal right stick does: Move sliders right and left. Move selection in select boxes.protected voidrightStickHorizontal(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) voidrightStickVertical(float value) By default, the vertical right stick does: Change the selection in select boxes. Move the first scroll pane found in the content up and down.protected voidrightStickVertical(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) protected voidrightTrigger(float value) The right trigger does: Move sliders right. Move selection in select boxes down.protected voidrightTrigger(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) abstract voidselect()abstract voidstart()abstract voidtabLeft()abstract voidtabRight()Methods inherited from class AbstractGamepadListener
activate, anyPressed, anyPressed, applyZeroPoint, buttonUp, 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.booleanbuttonUp(com.badlogic.gdx.controllers.Controller controller, int buttonCode) 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.
-
Field Details
-
stage
protected final com.badlogic.gdx.scenes.scene2d.Stage stage
-
-
Constructor Details
-
GuiGamepadListener
-
GuiGamepadListener
protected GuiGamepadListener(IGamepadMappings mappings, com.badlogic.gdx.scenes.scene2d.Stage stage)
-
-
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
-
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.
-
getContentContainers
public com.badlogic.gdx.utils.Array<com.badlogic.gdx.scenes.scene2d.Group> getContentContainers() -
actionDown
public void actionDown()By default, the main action acts on the keyboard focus actor by firing a change event or checking it, if it is a checkbox. -
back
public abstract void back() -
start
public abstract void start() -
select
public abstract void select() -
tabLeft
public abstract void tabLeft() -
tabRight
public abstract void tabRight() -
moveLeft
public abstract void moveLeft() -
moveRight
public abstract void moveRight() -
moveUp
public void moveUp()Moves the focus up. -
moveDown
public void moveDown()Moves the focus down. -
moveFocusVertical
public void moveFocusVertical(boolean up) -
rightStickVertical
public void rightStickVertical(float value) By default, the vertical right stick does:- Change the selection in select boxes.
- Move the first scroll pane found in the content up and down.
- Parameters:
value- The axis value.
-
rightStickVertical
protected void rightStickVertical(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) -
rightStickHorizontal
public void rightStickHorizontal(float value) By default, the horizontal right stick does:- Move sliders right and left.
- Move selection in select boxes.
- Parameters:
value- The axis value.
-
rightStickHorizontal
protected void rightStickHorizontal(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) -
rightTrigger
protected void rightTrigger(float value) The right trigger does:- Move sliders right.
- Move selection in select boxes down.
- Parameters:
value- The axis value.
-
rightTrigger
protected void rightTrigger(com.badlogic.gdx.scenes.scene2d.Actor focus, float value) -
leftTrigger
protected void leftTrigger(float value) The left trigger does:- Move sliders left.
- Move selection in select boxes up.
- Parameters:
value- The axis value.
-
leftTrigger
protected void leftTrigger(com.badlogic.gdx.scenes.scene2d.Actor focus, float value)
-