Package gaiasky.input
Class AbstractGamepadListener
java.lang.Object
gaiasky.input.AbstractGamepadListener
- All Implemented Interfaces:
com.badlogic.gdx.controllers.ControllerListener
,IObserver
,IInputListener
- Direct Known Subclasses:
MainGamepadListener
,SpacecraftGamepadListener
public abstract class AbstractGamepadListener
extends Object
implements com.badlogic.gdx.controllers.ControllerListener, IInputListener, IObserver
Contains some utils common to all gamepad listeners.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final long
protected static final long
protected static final double
protected final EventManager
protected long
protected long
protected IControllerMappings
protected final com.badlogic.gdx.utils.IntSet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
void
addPressedKey
(int keycode) boolean
anyPressed
(int... keys) Returns true if any of the keys are pressedprotected double
applyZeroPoint
(double value) Zero-point function for the axes.void
connected
(com.badlogic.gdx.controllers.Controller controller) void
void
disconnected
(com.badlogic.gdx.controllers.Controller controller) boolean
isKeyPressed
(int keycode) void
Event notification call.void
removePressedKey
(int keycode) void
update()
boolean
updateControllerMappings
(String mappingsFile) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.badlogic.gdx.controllers.ControllerListener
axisMoved, buttonDown, buttonUp
-
Field Details
-
AXIS_TH
protected static final double AXIS_TH- See Also:
-
AXIS_EVT_DELAY
protected static final long AXIS_EVT_DELAY- See Also:
-
AXIS_POLL_DELAY
protected static final long AXIS_POLL_DELAY- See Also:
-
mappings
-
em
-
pressedKeys
protected final com.badlogic.gdx.utils.IntSet pressedKeys -
lastAxisEvtTime
protected long lastAxisEvtTime -
lastAxisPollTime
protected long lastAxisPollTime
-
-
Constructor Details
-
AbstractGamepadListener
-
-
Method Details
-
applyZeroPoint
protected double applyZeroPoint(double value) Zero-point function for the axes. -
getMappings
-
updateControllerMappings
-
addPressedKey
public void addPressedKey(int keycode) -
removePressedKey
public void removePressedKey(int keycode) -
isKeyPressed
public boolean isKeyPressed(int keycode) -
anyPressed
public boolean anyPressed(int... keys) Returns true if any of the keys are pressed- Parameters:
keys
- The keys to test- Returns:
- True if any is pressed
-
connected
public void connected(com.badlogic.gdx.controllers.Controller controller) - Specified by:
connected
in interfacecom.badlogic.gdx.controllers.ControllerListener
-
disconnected
public void disconnected(com.badlogic.gdx.controllers.Controller controller) - Specified by:
disconnected
in interfacecom.badlogic.gdx.controllers.ControllerListener
-
update
public void update()- Specified by:
update
in interfaceIInputListener
-
activate
public void activate()- Specified by:
activate
in interfaceIInputListener
-
deactivate
public void deactivate()- Specified by:
deactivate
in interfaceIInputListener
-
notify
Description copied from interface:IObserver
Event notification call.
-