com.badlogic.gdx.scenes.scene2d
Class InputEvent

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Event
      extended by com.badlogic.gdx.scenes.scene2d.InputEvent
All Implemented Interfaces:
Pool.Poolable

public class InputEvent
extends Event

Event for actor input: touch, mouse, keyboard, and scroll.

See Also:
InputListener

Nested Class Summary
static class InputEvent.Type
          Types of low-level input events supported by stage2d.
 
Constructor Summary
InputEvent()
           
 
Method Summary
 int getButton()
          The index for the mouse button pressed.
 char getCharacter()
          The character for the key that was type.
 int getKeyCode()
          The key code of the key that was pressed.
 int getPointer()
          The pointer index for the event.
 Actor getRelatedActor()
          The actor related to the event.
 int getScrollAmount()
          The amount the mouse was scrolled.
 float getStageX()
          The stage x coordinate where the event occurred.
 float getStageY()
          The stage x coordinate where the event occurred.
 InputEvent.Type getType()
          The type of input event.
 boolean isTouchFocusCancel()
          Returns true of this event is a touchUp triggered by Stage.cancelTouchFocus().
 void reset()
          Resets the object for reuse.
 void setButton(int button)
           
 void setCharacter(char character)
           
 void setKeyCode(int keyCode)
           
 void setPointer(int pointer)
           
 void setRelatedActor(Actor relatedActor)
           
 void setScrollAmount(int scrollAmount)
           
 void setStageX(float stageX)
           
 void setStageY(float stageY)
           
 void setType(InputEvent.Type type)
           
 Vector2 toCoordinates(Actor actor, Vector2 actorCoords)
          Sets actorCoords to this event's coordinates relative to the specified actor.
 String toString()
           
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Event
cancel, getBubbles, getListenerActor, getStage, getTarget, handle, isCancelled, isCapture, isHandled, isStopped, setBubbles, setCapture, setListenerActor, setStage, setTarget, stop
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InputEvent

public InputEvent()
Method Detail

reset

public void reset()
Description copied from interface: Pool.Poolable
Resets the object for reuse. Object references should be nulled and fields may be set to default values.

Specified by:
reset in interface Pool.Poolable
Overrides:
reset in class Event

getStageX

public float getStageX()
The stage x coordinate where the event occurred. Valid for: touchDown, touchDragged, touchUp, mouseMoved, enter, and exit.


setStageX

public void setStageX(float stageX)

getStageY

public float getStageY()
The stage x coordinate where the event occurred. Valid for: touchDown, touchDragged, touchUp, mouseMoved, enter, and exit.


setStageY

public void setStageY(float stageY)

getType

public InputEvent.Type getType()
The type of input event.


setType

public void setType(InputEvent.Type type)

getPointer

public int getPointer()
The pointer index for the event. The first touch is index 0, second touch is index 1, etc. Always -1 on desktop. Valid for: touchDown, touchDragged, touchUp, enter, and exit.


setPointer

public void setPointer(int pointer)

getButton

public int getButton()
The index for the mouse button pressed. Always 0 on Android. Valid for: touchDown and touchUp.

See Also:
Input.Buttons

setButton

public void setButton(int button)

getKeyCode

public int getKeyCode()
The key code of the key that was pressed. Valid for: keyDown and keyUp.


setKeyCode

public void setKeyCode(int keyCode)

getCharacter

public char getCharacter()
The character for the key that was type. Valid for: keyTyped.


setCharacter

public void setCharacter(char character)

getScrollAmount

public int getScrollAmount()
The amount the mouse was scrolled. Valid for: scrolled.


setScrollAmount

public void setScrollAmount(int scrollAmount)

getRelatedActor

public Actor getRelatedActor()
The actor related to the event. Valid for: enter and exit. For enter, this is the actor being exited, or null. For exit, this is the actor being entered, or null.


setRelatedActor

public void setRelatedActor(Actor relatedActor)
Parameters:
relatedActor - May be null.

toCoordinates

public Vector2 toCoordinates(Actor actor,
                             Vector2 actorCoords)
Sets actorCoords to this event's coordinates relative to the specified actor.

Parameters:
actorCoords - Output for resulting coordinates.

isTouchFocusCancel

public boolean isTouchFocusCancel()
Returns true of this event is a touchUp triggered by Stage.cancelTouchFocus().


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.