Package com.badlogic.gdx
Interface InputProcessor
-
- All Known Implementing Classes:
CameraInputController,FirstPersonCameraController,GestureDetector,InputAdapter,InputMultiplexer,RemoteSender,Stage
public interface InputProcessorAn InputProcessor is used to receive input events from the keyboard and the touch screen (mouse on the desktop). For this it has to be registered with theInput.setInputProcessor(InputProcessor)method. It will be called each frame before the call toApplicationListener.render(). Each method returns a boolean in case you want to use this with theInputMultiplexerto chain input processors.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleankeyDown(int keycode)Called when a key was pressedbooleankeyTyped(char character)Called when a key was typedbooleankeyUp(int keycode)Called when a key was releasedbooleanmouseMoved(int screenX, int screenY)Called when the mouse was moved without any buttons being pressed.booleanscrolled(float amountX, float amountY)Called when the mouse wheel was scrolled.booleantouchCancelled(int screenX, int screenY, int pointer, int button)Called when the touch gesture is cancelled.booleantouchDown(int screenX, int screenY, int pointer, int button)Called when the screen was touched or a mouse button was pressed.booleantouchDragged(int screenX, int screenY, int pointer)Called when a finger or the mouse was dragged.booleantouchUp(int screenX, int screenY, int pointer, int button)Called when a finger was lifted or a mouse button was released.
-
-
-
Method Detail
-
keyDown
boolean keyDown(int keycode)
Called when a key was pressed- Parameters:
keycode- one of the constants inInput.Keys- Returns:
- whether the input was processed
-
keyUp
boolean keyUp(int keycode)
Called when a key was released- Parameters:
keycode- one of the constants inInput.Keys- Returns:
- whether the input was processed
-
keyTyped
boolean keyTyped(char character)
Called when a key was typed- Parameters:
character- The character- Returns:
- whether the input was processed
-
touchDown
boolean touchDown(int screenX, int screenY, int pointer, int button)Called when the screen was touched or a mouse button was pressed. The button parameter will beInput.Buttons.LEFTon iOS.- Parameters:
screenX- The x coordinate, origin is in the upper left cornerscreenY- The y coordinate, origin is in the upper left cornerpointer- the pointer for the event.button- the button- Returns:
- whether the input was processed
-
touchUp
boolean touchUp(int screenX, int screenY, int pointer, int button)Called when a finger was lifted or a mouse button was released. The button parameter will beInput.Buttons.LEFTon iOS.- Parameters:
pointer- the pointer for the event.button- the button- Returns:
- whether the input was processed
-
touchCancelled
boolean touchCancelled(int screenX, int screenY, int pointer, int button)Called when the touch gesture is cancelled. Reason may be from OS interruption to touch becoming a large surface such as the user cheek). Relevant on Android and iOS only. The button parameter will beInput.Buttons.LEFTon iOS.- Parameters:
pointer- the pointer for the event.button- the button- Returns:
- whether the input was processed
-
touchDragged
boolean touchDragged(int screenX, int screenY, int pointer)Called when a finger or the mouse was dragged.- Parameters:
pointer- the pointer for the event.- Returns:
- whether the input was processed
-
mouseMoved
boolean mouseMoved(int screenX, int screenY)Called when the mouse was moved without any buttons being pressed. Will not be called on iOS.- Returns:
- whether the input was processed
-
scrolled
boolean scrolled(float amountX, float amountY)Called when the mouse wheel was scrolled. Will not be called on iOS.- Parameters:
amountX- the horizontal scroll amount, negative or positive depending on the direction the wheel was scrolled.amountY- the vertical scroll amount, negative or positive depending on the direction the wheel was scrolled.- Returns:
- whether the input was processed.
-
-