Package arc.scene.event
Class InputListener
java.lang.Object
arc.scene.event.InputListener
- All Implemented Interfaces:
EventListener
- Direct Known Subclasses:
ClickListener
,DragListener
,MapObjectivesCanvas.ObjectiveTilemap.ObjectiveTile.Mover
,Tooltip
EventListener for low-level input events. Unpacks
InputEvent
s and calls the appropriate method. By default the methods
here do nothing with the event. Users are expected to override the methods they are interested in, like this:-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
enter
(InputEvent event, float x, float y, int pointer, Element fromActor) Called any time the mouse cursor or a finger touch is moved over an element.void
exit
(InputEvent event, float x, float y, int pointer, Element toActor) Called any time the mouse cursor or a finger touch is moved out of an element.boolean
handle
(SceneEvent e) Try to handle the given event, if it is applicable.boolean
keyDown
(InputEvent event, KeyCode keycode) Called when a key goes down.boolean
keyTyped
(InputEvent event, char character) Called when a key is typed.boolean
keyUp
(InputEvent event, KeyCode keycode) Called when a key goes up.boolean
mouseMoved
(InputEvent event, float x, float y) Called any time the mouse is moved when a button is not down.boolean
scrolled
(InputEvent event, float x, float y, float amountX, float amountY) Called when the mouse wheel has been scrolled.boolean
touchDown
(InputEvent event, float x, float y, int pointer, KeyCode button) Called when a mouse button or a finger touch goes down on the element.void
touchDragged
(InputEvent event, float x, float y, int pointer) Called when a mouse button or a finger touch is moved anywhere, but only if touchDown previously returned true for the mouse button or touch.void
touchUp
(InputEvent event, float x, float y, int pointer, KeyCode button) Called when a mouse button or a finger touch goes up anywhere, but only if touchDown previously returned true for the mouse button or touch.
-
Constructor Details
-
InputListener
public InputListener()
-
-
Method Details
-
handle
Description copied from interface:EventListener
Try to handle the given event, if it is applicable.- Specified by:
handle
in interfaceEventListener
- Returns:
- true if the event should be considered
handled
by scene2d.
-
touchDown
Called when a mouse button or a finger touch goes down on the element. If true is returned, this listener will receive all touchDragged and touchUp events, even those not over this element, until touchUp is received. Also when true is returned, the event ishandled
.- See Also:
-
touchUp
Called when a mouse button or a finger touch goes up anywhere, but only if touchDown previously returned true for the mouse button or touch. The touchUp event is alwayshandled
.- See Also:
-
touchDragged
Called when a mouse button or a finger touch is moved anywhere, but only if touchDown previously returned true for the mouse button or touch. The touchDragged event is alwayshandled
.- See Also:
-
mouseMoved
Called any time the mouse is moved when a button is not down. This event only occurs on the desktop. When true is returned, the event ishandled
.- See Also:
-
enter
Called any time the mouse cursor or a finger touch is moved over an element. On the desktop, this event occurs even when no mouse buttons are pressed (pointer will be -1).- Parameters:
fromActor
- May be null.- See Also:
-
exit
Called any time the mouse cursor or a finger touch is moved out of an element. On the desktop, this event occurs even when no mouse buttons are pressed (pointer will be -1).- Parameters:
toActor
- May be null.- See Also:
-
scrolled
Called when the mouse wheel has been scrolled. When true is returned, the event ishandled
. -
keyDown
Called when a key goes down. When true is returned, the event ishandled
. -
keyUp
Called when a key goes up. When true is returned, the event ishandled
. -
keyTyped
Called when a key is typed. When true is returned, the event ishandled
.
-