Package arc.input
Class InputMultiplexer
java.lang.Object
arc.input.InputMultiplexer
- All Implemented Interfaces:
InputProcessor
An
InputProcessor
that delegates to an ordered list of other InputProcessors. Delegation for an event stops if a
processor returns true, which indicates that the event was handled.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProcessor
(int index, InputProcessor processor) void
addProcessor
(InputProcessor processor) void
clear()
void
connected
(InputDevice device) Called when an input device is connected.void
disconnected
(InputDevice device) Called when an input device is disconnected.boolean
Called when a key was pressedboolean
keyTyped
(char character) Called when a key was typedboolean
Called when a key was releasedboolean
mouseMoved
(int screenX, int screenY) void
removeProcessor
(int index) void
removeProcessor
(InputProcessor processor) boolean
scrolled
(float amountX, float amountY) Called when the mouse wheel was scrolled.void
setProcessors
(InputProcessor... processors) void
setProcessors
(Seq<InputProcessor> processors) int
size()
boolean
boolean
touchDragged
(int screenX, int screenY, int pointer) Called when a finger or the mouse was dragged.boolean
-
Constructor Details
-
InputMultiplexer
public InputMultiplexer() -
InputMultiplexer
-
-
Method Details
-
addProcessor
-
removeProcessor
public void removeProcessor(int index) -
addProcessor
-
removeProcessor
-
size
public int size()- Returns:
- the number of processors in this multiplexer
-
clear
public void clear() -
getProcessors
-
setProcessors
-
setProcessors
-
connected
Description copied from interface:InputProcessor
Called when an input device is connected.- Specified by:
connected
in interfaceInputProcessor
-
disconnected
Description copied from interface:InputProcessor
Called when an input device is disconnected.- Specified by:
disconnected
in interfaceInputProcessor
-
keyDown
Description copied from interface:InputProcessor
Called when a key was pressed- Specified by:
keyDown
in interfaceInputProcessor
- Returns:
- whether the input was processed
-
keyUp
Description copied from interface:InputProcessor
Called when a key was released- Specified by:
keyUp
in interfaceInputProcessor
- Returns:
- whether the input was processed
-
keyTyped
public boolean keyTyped(char character) Description copied from interface:InputProcessor
Called when a key was typed- Specified by:
keyTyped
in interfaceInputProcessor
- Parameters:
character
- The character- Returns:
- whether the input was processed
-
touchDown
- Specified by:
touchDown
in interfaceInputProcessor
- 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
- Specified by:
touchUp
in interfaceInputProcessor
pointer
- the pointer for the event.button
- the button- Returns:
- whether the input was processed
-
touchDragged
public boolean touchDragged(int screenX, int screenY, int pointer) Description copied from interface:InputProcessor
Called when a finger or the mouse was dragged.- Specified by:
touchDragged
in interfaceInputProcessor
pointer
- the pointer for the event.- Returns:
- whether the input was processed
-
mouseMoved
public boolean mouseMoved(int screenX, int screenY) - Specified by:
mouseMoved
in interfaceInputProcessor
- Returns:
- whether the input was processed
-
scrolled
public boolean scrolled(float amountX, float amountY) Description copied from interface:InputProcessor
Called when the mouse wheel was scrolled. Will not be called on iOS.- Specified by:
scrolled
in interfaceInputProcessor
- 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.
-