libgdx API

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
           
 
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 occured.
 float getStageY()
          The stage x coordinate where the event occured.
 InputEvent.Type getType()
          The type of input event.
 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)
           
 java.lang.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
clone, equals, finalize, 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 occured. 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 occured. 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.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

libgdx API

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