Class AbstractMouseKbdListener
java.lang.Object
com.badlogic.gdx.InputAdapter
com.badlogic.gdx.input.GestureDetector
gaiasky.input.AbstractMouseKbdListener
- All Implemented Interfaces:
com.badlogic.gdx.InputProcessor, IInputListener
- Direct Known Subclasses:
GameMouseKbdListener, GuiKbdListener, MainMouseKbdListener, SpacecraftMouseKbdListener
public abstract class AbstractMouseKbdListener
extends com.badlogic.gdx.input.GestureDetector
implements IInputListener
-
Nested Class Summary
Nested classes/interfaces inherited from class com.badlogic.gdx.input.GestureDetector
com.badlogic.gdx.input.GestureDetector.GestureAdapter, com.badlogic.gdx.input.GestureDetector.GestureListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicBooleanprotected ICameraprotected longprotected longMinimum time after key press before polling starts. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMouseKbdListener(com.badlogic.gdx.input.GestureDetector.GestureListener gl, ICamera camera) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activate the listener.booleanallPressed(int... keys) Returns true if all keys are pressedbooleanallPressed(Collection<Integer> keys) booleananyPressed(int... keys) Returns true if any of the physical keys are pressed.booleananyPressedLogical(int... keys) Same asanyPressed(int...), but converts the physical keys to logical keys first.voidDeactivate the listener.protected floatfloatbooleanisActive()booleanisKeyPressed(int keyCode) Returns whether the key is pressed.booleanisLogicalKeyPressed(int keyCode) Returns whether the given logical key code is pressed.booleankeyDown(int keyCode) booleankeyUp(int keyCode) protected abstract booleanpollKeys()Implement key polling here.booleanscrolled(float amountX, float amountY) booleantouchDown(float x, float y, int pointer, int button) booleantouchDown(int x, int y, int pointer, int button) booleantouchUp(float x, float y, int pointer, int button) booleantouchUp(int x, int y, int pointer, int button) voidupdate()Update the listener.Methods inherited from class com.badlogic.gdx.input.GestureDetector
cancel, invalidateTapSquare, isLongPressed, isLongPressed, isPanning, reset, setLongPressSeconds, setMaxFlingDelay, setTapCountInterval, setTapRectangleSize, setTapSquareSize, touchCancelled, touchDragged, touchDraggedMethods inherited from class com.badlogic.gdx.InputAdapter
keyTyped, mouseMoved
-
Field Details
-
active
-
iCamera
-
minPollInterval
protected long minPollIntervalMinimum time after key press before polling starts. -
lastPollTime
protected long lastPollTime
-
-
Constructor Details
-
AbstractMouseKbdListener
protected AbstractMouseKbdListener(com.badlogic.gdx.input.GestureDetector.GestureListener gl, ICamera camera)
-
-
Method Details
-
keyDown
public boolean keyDown(int keyCode) - Specified by:
keyDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
keyDownin classcom.badlogic.gdx.InputAdapter
-
keyUp
public boolean keyUp(int keyCode) - Specified by:
keyUpin interfacecom.badlogic.gdx.InputProcessor- Overrides:
keyUpin classcom.badlogic.gdx.InputAdapter
-
isKeyPressed
public boolean isKeyPressed(int keyCode) Returns whether the key is pressed.- Parameters:
keyCode- The key code as found inInput.Keys.- Returns:
- true or false.
-
isLogicalKeyPressed
public boolean isLogicalKeyPressed(int keyCode) Returns whether the given logical key code is pressed.- Parameters:
keyCode- The logical key code as found inInput.Keys.- Returns:
- true or false.
-
allPressed
public boolean allPressed(int... keys) Returns true if all keys are pressed- Parameters:
keys- The keys to test- Returns:
- True if all are pressed
-
allPressed
-
anyPressed
public boolean anyPressed(int... keys) Returns true if any of the physical keys are pressed.- Parameters:
keys- The keys to test.- Returns:
- True if any physical keys are pressed.
-
anyPressedLogical
public boolean anyPressedLogical(int... keys) Same asanyPressed(int...), but converts the physical keys to logical keys first.- Parameters:
keys- The logical keys.- Returns:
- Whether any of the keys are pressed.
-
getResponseTime
public float getResponseTime() -
update
public void update()Description copied from interface:IInputListenerUpdate the listener.- Specified by:
updatein interfaceIInputListener
-
touchUp
public boolean touchUp(float x, float y, int pointer, int button) - Overrides:
touchUpin classcom.badlogic.gdx.input.GestureDetector
-
touchUp
public boolean touchUp(int x, int y, int pointer, int button) - Specified by:
touchUpin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchUpin classcom.badlogic.gdx.input.GestureDetector
-
touchDown
public boolean touchDown(float x, float y, int pointer, int button) - Overrides:
touchDownin classcom.badlogic.gdx.input.GestureDetector
-
touchDown
public boolean touchDown(int x, int y, int pointer, int button) - Specified by:
touchDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDownin classcom.badlogic.gdx.input.GestureDetector
-
scrolled
public boolean scrolled(float amountX, float amountY) - Specified by:
scrolledin interfacecom.badlogic.gdx.InputProcessor- Overrides:
scrolledin classcom.badlogic.gdx.InputAdapter
-
pollKeys
protected abstract boolean pollKeys()Implement key polling here.- Returns:
- True if an action was successfully executed.
-
isActive
public boolean isActive() -
activate
public void activate()Description copied from interface:IInputListenerActivate the listener.- Specified by:
activatein interfaceIInputListener
-
deactivate
public void deactivate()Description copied from interface:IInputListenerDeactivate the listener.- Specified by:
deactivatein interfaceIInputListener
-
getFpsScale
protected float getFpsScale()
-