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 longprotected static final longprotected static final doubleprotected final EventManagerprotected longprotected longprotected IControllerMappingsprotected final com.badlogic.gdx.utils.IntSet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()voidaddPressedKey(int keycode) booleananyPressed(int... keys) Returns true if any of the keys are pressedprotected doubleapplyZeroPoint(double value) Zero-point function for the axes.voidconnected(com.badlogic.gdx.controllers.Controller controller) voidvoiddisconnected(com.badlogic.gdx.controllers.Controller controller) booleanisKeyPressed(int keycode) voidEvent notification call.voidremovePressedKey(int keycode) voidupdate()booleanupdateControllerMappings(String mappingsFile) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
connectedin interfacecom.badlogic.gdx.controllers.ControllerListener
-
disconnected
public void disconnected(com.badlogic.gdx.controllers.Controller controller) - Specified by:
disconnectedin interfacecom.badlogic.gdx.controllers.ControllerListener
-
update
public void update()- Specified by:
updatein interfaceIInputListener
-
activate
public void activate()- Specified by:
activatein interfaceIInputListener
-
deactivate
public void deactivate()- Specified by:
deactivatein interfaceIInputListener
-
notify
Description copied from interface:IObserverEvent notification call.
-