libgdx API

com.badlogic.gdx.scenes.scene2d
Class InputListener

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.InputListener
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
ClickListener, DragListener

public class InputListener
extends java.lang.Object
implements EventListener

Listener for actor input events.


Constructor Summary
InputListener()
           
 
Method Summary
 void enter(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.
 void exit(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.
 boolean handle(Event e)
           
 boolean keyDown(InputEvent event, int keycode)
          Called when a key goes down.
 boolean keyTyped(InputEvent event, char character)
          Called when a key is typed.
 boolean keyUp(InputEvent event, int 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, int amount)
          Called when the mouse wheel has been scrolled.
 boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
          Called when a mouse button or a finger touch goes down on the actor.
 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, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputListener

public InputListener()
Method Detail

handle

public boolean handle(Event e)
Specified by:
handle in interface EventListener

touchDown

public boolean touchDown(InputEvent event,
                         float x,
                         float y,
                         int pointer,
                         int button)
Called when a mouse button or a finger touch goes down on the actor. If true is returned, this listener will receive all touchDragged and touchUp events, even those not over this actor, until touchUp is received. Also when true is returned, the event is handled.

See Also:
InputEvent

touchUp

public void touchUp(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. The touchUp event is always handled.

See Also:
InputEvent

touchDragged

public 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. The touchDragged event is always handled.

See Also:
InputEvent

mouseMoved

public boolean mouseMoved(InputEvent event,
                          float x,
                          float y)
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 is handled.

See Also:
InputEvent

enter

public void enter(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. On the desktop, this event occurs even when no mouse buttons are pressed (pointer will be -1).

See Also:
InputEvent

exit

public void exit(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. On the desktop, this event occurs even when no mouse buttons are pressed (pointer will be -1).

See Also:
InputEvent

scrolled

public boolean scrolled(InputEvent event,
                        float x,
                        float y,
                        int amount)
Called when the mouse wheel has been scrolled. When true is returned, the event is handled.


keyDown

public boolean keyDown(InputEvent event,
                       int keycode)
Called when a key goes down. When true is returned, the event is handled.


keyUp

public boolean keyUp(InputEvent event,
                     int keycode)
Called when a key goes up. When true is returned, the event is handled.


keyTyped

public boolean keyTyped(InputEvent event,
                        char character)
Called when a key is typed. When true is returned, the event is handled.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)