APIdia Launch Partner
Top Description Methods
com.badlogic.gdx

public Interface InputProcessor

Known Direct Implementers
com.badlogic.gdx.input.RemoteSender, com.badlogic.gdx.InputAdapter, com.badlogic.gdx.InputMultiplexer
Imports
com.badlogic.gdx.Input.Buttons

An 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 the Input#setInputProcessor(InputProcessor) method. It will be called each frame before the call to ApplicationListener#render(). Each method returns a boolean in case you want to use this with the InputMultiplexer to chain input processors.
Author
mzechner

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

whether the input was processed
keyDown
(int
one of the constants in Input.Keys
keycode
)

Called when a key was pressed

public boolean

Returns:

whether the input was processed
keyTyped
(char
The character
character
)

Called when a key was typed

public boolean

Returns:

whether the input was processed
keyUp
(int
one of the constants in Input.Keys
keycode
)

Called when a key was released

public boolean

Returns:

whether the input was processed
mouseMoved
(int screenX, int screenY)

Called when the mouse was moved without any buttons being pressed.

public boolean

Returns:

whether the input was processed.
scrolled
(float
the horizontal scroll amount, negative or positive depending on the direction the wheel was scrolled.
amountX
,
float
the vertical scroll amount, negative or positive depending on the direction the wheel was scrolled.
amountY
)

Called when the mouse wheel was scrolled.

public boolean

Returns:

whether the input was processed
touchCancelled
(int screenX, int screenY, int
the pointer for the event.
pointer
,
int
the button
button
)

Called when the touch gesture is cancelled.

public boolean

Returns:

whether the input was processed
touchDown
(int
The x coordinate, origin is in the upper left corner
screenX
,
int
The y coordinate, origin is in the upper left corner
screenY
,
int
the pointer for the event.
pointer
,
int
the button
button
)

Called when the screen was touched or a mouse button was pressed.

public boolean

Returns:

whether the input was processed
touchDragged
(int screenX, int screenY, int
the pointer for the event.
pointer
)

Called when a finger or the mouse was dragged.

public boolean

Returns:

whether the input was processed
touchUp
(int screenX, int screenY, int
the pointer for the event.
pointer
,
int
the button
button
)

Called when a finger was lifted or a mouse button was released.

Method Detail

keyDownback to summary
public boolean keyDown(int keycode)

Called when a key was pressed

Parameters
keycode:int

one of the constants in Input.Keys

Returns:boolean

whether the input was processed

keyTypedback to summary
public boolean keyTyped(char character)

Called when a key was typed

Parameters
character:char

The character

Returns:boolean

whether the input was processed

keyUpback to summary
public boolean keyUp(int keycode)

Called when a key was released

Parameters
keycode:int

one of the constants in Input.Keys

Returns:boolean

whether the input was processed

mouseMovedback to summary
public boolean mouseMoved(int screenX, int screenY)

Called when the mouse was moved without any buttons being pressed. Will not be called on iOS.

Returns:boolean

whether the input was processed

scrolledback to summary
public boolean scrolled(float amountX, float amountY)

Called when the mouse wheel was scrolled. Will not be called on iOS.

Parameters
amountX:float

the horizontal scroll amount, negative or positive depending on the direction the wheel was scrolled.

amountY:float

the vertical scroll amount, negative or positive depending on the direction the wheel was scrolled.

Returns:boolean

whether the input was processed.

touchCancelledback to summary
public 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 be Buttons#LEFT on iOS.

Parameters
pointer:int

the pointer for the event.

button:int

the button

Returns:boolean

whether the input was processed

touchDownback to summary
public 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 be Buttons#LEFT on iOS.

Parameters
screenX:int

The x coordinate, origin is in the upper left corner

screenY:int

The y coordinate, origin is in the upper left corner

pointer:int

the pointer for the event.

button:int

the button

Returns:boolean

whether the input was processed

touchDraggedback to summary
public boolean touchDragged(int screenX, int screenY, int pointer)

Called when a finger or the mouse was dragged.

Parameters
pointer:int

the pointer for the event.

Returns:boolean

whether the input was processed

touchUpback to summary
public 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 be Buttons#LEFT on iOS.

Parameters
pointer:int

the pointer for the event.

button:int

the button

Returns:boolean

whether the input was processed