Package com.prineside.tdi2.scene2d
Class InputListener
java.lang.Object
com.prineside.tdi2.scene2d.InputListener
- All Implemented Interfaces:
 EventListener
- Direct Known Subclasses:
 ClickListener,CursorGraphicsManager.CustomCursorActorListener,DragListener,InputListenerExtended,InputVoid,Tooltip
EventListener for low-level input events. Unpacks 
InputEvents 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:
 
 
 actor.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
                Gdx.app.log("Example", "touch started at (" + x + ", " + y + ")");
                return false;
        }
 
        public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
                Gdx.app.log("Example", "touch done at (" + x + ", " + y + ")");
        }
 });
 - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidenter(InputEvent event, float x, float y, int pointer, Actor fromActor) Called any time the mouse cursor or a finger touch is moved over an actor.voidexit(InputEvent event, float x, float y, int pointer, Actor toActor) Called any time the mouse cursor or a finger touch is moved out of an actor.booleanTry to handle the given event, if it is anInputEvent.booleankeyDown(InputEvent event, int keycode) Called when a key goes down.booleankeyTyped(InputEvent event, char character) Called when a key is typed.booleankeyUp(InputEvent event, int keycode) Called when a key goes up.booleanmouseMoved(InputEvent event, float x, float y) Called any time the mouse is moved when a button is not down.booleanscrolled(InputEvent event, float x, float y, float amountX, float amountY) Called when the mouse wheel has been scrolled.booleantouchDown(InputEvent event, float x, float y, int pointer, int button) Called when a mouse button or a finger touch goes down on the actor.voidtouchDragged(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.voidtouchUp(InputEvent event, float x, float y, int pointer, int 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
Try to handle the given event, if it is anInputEvent.If the input event is of type
InputEvent.Type.touchDownandInputEvent.getTouchFocus()is true andtouchDown(InputEvent, float, float, int, int)returns true (indicating the event was handled) then this listener is added to the stage'stouch focusso it will receive all touch dragged events until the next touch up event.- Specified by:
 handlein interfaceEventListener- Returns:
 - true if the event should be considered 
handledby scene2d. 
 - 
touchDown
Called when a mouse button or a finger touch goes down on the actor. If true is returned, this listener will havetouch focus, so it will receive all touchDragged and touchUp events, even those not over this actor, 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 actor. 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 actor. 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.- Parameters:
 character- May be 0 for key typed events that don't map to a character (ctrl, shift, etc).
 
 -