Class MainMouseKbdListener
java.lang.Object
com.badlogic.gdx.InputAdapter
com.badlogic.gdx.input.GestureDetector
gaiasky.input.AbstractMouseKbdListener
gaiasky.input.MainMouseKbdListener
- All Implemented Interfaces:
com.badlogic.gdx.InputProcessor, IObserver, IInputListener
Implements the mouse and keyboard listener in default mode.
-
Nested Class Summary
Nested ClassesNested 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 TypeFieldDescriptionbooleanWhether scrolling requires the activeKey to be pressed (false) or always allow scrolling (true).protected intThe current (first) button being pressed.protected final MainMouseKbdListener.GaiaGestureListenerThe gesture listener.intThe button for rotating the camera either around its center or around the focus.intThe button for moving the camera along the direction axis.intThe button for panning the camera along the up/right plane.intThe key for rolling the camera.floatThe weight for each scrolled amount.Fields inherited from class AbstractMouseKbdListener
active, iCamera, lastPollTime, minPollIntervalModifier and TypeFieldDescriptionprotected final AtomicBooleanprotected ICameraprotected longprotected longMinimum time after key press before polling starts. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMainMouseKbdListener(MainMouseKbdListener.GaiaGestureListener gestureListener, NaturalCamera camera) MainMouseKbdListener(NaturalCamera camera) -
Method Summary
Modifier and TypeMethodDescriptionbooleankeyDown(int keyCode) voidEvent notification call.booleanpollKeys()Implement key polling here.protected booleanprocessDrag(int screenX, int screenY, double deltaX, double deltaY, int button) booleanscrolled(float amountX, float amountY) booleantouchDown(int screenX, int screenY, int pointer, int button) booleantouchDragged(int screenX, int screenY, int pointer) booleantouchUp(int screenX, int screenY, int pointer, int button) booleanzoom(float amount) Methods inherited from class AbstractMouseKbdListener
activate, allPressed, allPressed, anyPressed, anyPressedLogical, deactivate, getFpsScale, getResponseTime, isActive, isKeyPressed, isLogicalKeyPressed, keyUp, touchDown, touchUp, updateModifier 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 asAbstractMouseKbdListener.anyPressed(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.booleankeyUp(int keyCode) booleantouchDown(float x, float y, int pointer, int button) booleantouchUp(float x, float 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, touchDraggedMethods inherited from class com.badlogic.gdx.InputAdapter
keyTyped, mouseMoved
-
Field Details
-
gestureListener
The gesture listener. -
leftMouseButton
public int leftMouseButtonThe button for rotating the camera either around its center or around the focus. -
rightMouseButton
public int rightMouseButtonThe button for panning the camera along the up/right plane. -
middleMouseButton
public int middleMouseButtonThe button for moving the camera along the direction axis. -
alwaysScroll
public boolean alwaysScrollWhether scrolling requires the activeKey to be pressed (false) or always allow scrolling (true). -
scrollFactor
public float scrollFactorThe weight for each scrolled amount. -
rollKey
public int rollKeyThe key for rolling the camera. -
button
protected int buttonThe current (first) button being pressed.
-
-
Constructor Details
-
MainMouseKbdListener
protected MainMouseKbdListener(MainMouseKbdListener.GaiaGestureListener gestureListener, NaturalCamera camera) -
MainMouseKbdListener
-
-
Method Details
-
touchDown
public boolean touchDown(int screenX, int screenY, int pointer, int button) - Specified by:
touchDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDownin classAbstractMouseKbdListener
-
touchUp
public boolean touchUp(int screenX, int screenY, int pointer, int button) - Specified by:
touchUpin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchUpin classAbstractMouseKbdListener
-
processDrag
protected boolean processDrag(int screenX, int screenY, double deltaX, double deltaY, int button) -
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer) - Specified by:
touchDraggedin interfacecom.badlogic.gdx.InputProcessor- Overrides:
touchDraggedin classcom.badlogic.gdx.input.GestureDetector
-
scrolled
public boolean scrolled(float amountX, float amountY) - Specified by:
scrolledin interfacecom.badlogic.gdx.InputProcessor- Overrides:
scrolledin classAbstractMouseKbdListener
-
zoom
public boolean zoom(float amount) -
keyDown
public boolean keyDown(int keyCode) - Specified by:
keyDownin interfacecom.badlogic.gdx.InputProcessor- Overrides:
keyDownin classAbstractMouseKbdListener
-
pollKeys
public boolean pollKeys()Description copied from class:AbstractMouseKbdListenerImplement key polling here.- Specified by:
pollKeysin classAbstractMouseKbdListener- Returns:
- True if an action was successfully executed.
-
notify
-