APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d

public Class InputEvent

extends Event
Class Inheritance
Imports
com.badlogic.gdx.Input.Buttons, com.badlogic.gdx.math.Vector2, com.badlogic.gdx.utils.Null

Event for actor input: touch, mouse, touch/mouse actor enter/exit, mouse scroll, and keyboard events.
See Also
InputListener

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
InputEvent.Type

Types of low-level input events supported by scene2d.

Field Summary

Modifier and TypeField and Description
private int
private char
private int
private int
private Actor
private float
private float
private float
private float
private boolean
private InputEvent.Type

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
getButton()

The index for the mouse button pressed.

public char
getCharacter()

The character for the key that was typed.

public int
getKeyCode()

The key code of the key that was pressed.

public int
getPointer()

The pointer index for the event.

public Actor
getRelatedActor()

The actor related to the event.

public float
getScrollAmountX()

The amount the mouse was scrolled horizontally.

public float
getScrollAmountY()

The amount the mouse was scrolled vertically.

public float
getStageX()

The stage x coordinate where the event occurred.

public float
getStageY()

The stage x coordinate where the event occurred.

public boolean
getTouchFocus()

If false, InputListener#handle(Event) will not add the listener to the stage's touch focus when a touch down event is handled.

public InputEvent.Type
getType()

The type of input event.

public boolean
isTouchFocusCancel()

Returns true if this event is a touchUp triggered by Stage#cancelTouchFocus().

public void
public void
setButton(int button)

public void
setCharacter(char character)

public void
setKeyCode(int keyCode)

public void
setPointer(int pointer)

public void
setRelatedActor(Actor
May be null.
relatedActor
)

public void
setScrollAmountX(float scrollAmount)

public void
setScrollAmountY(float scrollAmount)

public void
setStageX(float stageX)

public void
setStageY(float stageY)

public void
setTouchFocus(boolean touchFocus)

public void
public Vector2
toCoordinates(Actor actor, Vector2
Output for resulting coordinates.
actorCoords
)

Sets actorCoords to this event's coordinates relative to the specified actor.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from com.badlogic.gdx.scenes.scene2d.Event:
cancelgetBubblesgetListenerActorgetStagegetTargethandleisCancelledisCaptureisHandledisStoppedsetBubblessetCapturesetListenerActorsetStagesetTargetstop

Field Detail

buttonback to summary
private int button
characterback to summary
private char character
keyCodeback to summary
private int keyCode
pointerback to summary
private int pointer
relatedActorback to summary
private Actor relatedActor
Annotations
@Null
scrollAmountXback to summary
private float scrollAmountX
scrollAmountYback to summary
private float scrollAmountY
stageXback to summary
private float stageX
stageYback to summary
private float stageY
touchFocusback to summary
private boolean touchFocus
typeback to summary
private InputEvent.Type type

Constructor Detail

InputEventback to summary
public InputEvent()

Method Detail

getButtonback to summary
public int getButton()

The index for the mouse button pressed. Always 0 on Android. Valid for: touchDown and touchUp.

See Also
Buttons
getCharacterback to summary
public char getCharacter()

The character for the key that was typed. Valid for: keyTyped.

getKeyCodeback to summary
public int getKeyCode()

The key code of the key that was pressed. Valid for: keyDown and keyUp.

getPointerback to summary
public int getPointer()

The pointer index for the event. The first touch is index 0, second touch is index 1, etc. On desktop it is always 0 for a touch, but -1 for enter/exit without a touch. Valid for: touchDown, touchDragged, touchUp, enter, and exit.

getRelatedActorback to summary
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.

Annotations
@Null
getScrollAmountXback to summary
public float getScrollAmountX()

The amount the mouse was scrolled horizontally. Valid for: scrolled.

getScrollAmountYback to summary
public float getScrollAmountY()

The amount the mouse was scrolled vertically. Valid for: scrolled.

getStageXback to summary
public float getStageX()

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

getStageYback to summary
public float getStageY()

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

getTouchFocusback to summary
public boolean getTouchFocus()

If false, InputListener#handle(Event) will not add the listener to the stage's touch focus when a touch down event is handled. Default is true.

getTypeback to summary
public InputEvent.Type getType()

The type of input event.

isTouchFocusCancelback to summary
public boolean isTouchFocusCancel()

Returns true if this event is a touchUp triggered by Stage#cancelTouchFocus().

resetback to summary
public void reset()

Overrides com.badlogic.gdx.scenes.scene2d.Event.reset.

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Doc from com.badlogic.gdx.utils.Pool.Poolable.reset.

Resets the object for reuse. Object references should be nulled and fields may be set to default values.

setButtonback to summary
public void setButton(int button)
setCharacterback to summary
public void setCharacter(char character)
setKeyCodeback to summary
public void setKeyCode(int keyCode)
setPointerback to summary
public void setPointer(int pointer)
setRelatedActorback to summary
public void setRelatedActor(Actor relatedActor)
Parameters
relatedActor:Actor

May be null.

setScrollAmountXback to summary
public void setScrollAmountX(float scrollAmount)
setScrollAmountYback to summary
public void setScrollAmountY(float scrollAmount)
setStageXback to summary
public void setStageX(float stageX)
setStageYback to summary
public void setStageY(float stageY)
setTouchFocusback to summary
public void setTouchFocus(boolean touchFocus)
setTypeback to summary
public void setType(InputEvent.Type type)
toCoordinatesback to summary
public Vector2 toCoordinates(Actor actor, Vector2 actorCoords)

Sets actorCoords to this event's coordinates relative to the specified actor.

Parameters
actorCoords:Vector2

Output for resulting coordinates.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

com.badlogic.gdx.scenes.scene2d back to summary

public final Enum InputEvent.Type

extends Enum<InputEvent.Type>
Class Inheritance

Types of low-level input events supported by scene2d.

Field Summary

Modifier and TypeField and Description
public static final InputEvent.Type
enter

The mouse pointer or an active touch have entered (i.e., hit) an actor.

public static final InputEvent.Type
exit

The mouse pointer or an active touch have exited an actor.

public static final InputEvent.Type
keyDown

A keyboard key has been pressed.

public static final InputEvent.Type
keyTyped

A keyboard key has been pressed and released.

public static final InputEvent.Type
keyUp

A keyboard key has been released.

public static final InputEvent.Type
mouseMoved

The mouse pointer has moved (without a mouse button being active).

public static final InputEvent.Type
scrolled

The mouse scroll wheel has changed.

public static final InputEvent.Type
touchDown

A new touch for a pointer on the stage was detected

public static final InputEvent.Type
touchDragged

A pointer that is touching the stage has moved.

public static final InputEvent.Type
touchUp

A pointer has stopped touching the stage.

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public static InputEvent.Type
public static InputEvent.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

enterback to summary
public static final InputEvent.Type enter

The mouse pointer or an active touch have entered (i.e., hit) an actor.

exitback to summary
public static final InputEvent.Type exit

The mouse pointer or an active touch have exited an actor.

keyDownback to summary
public static final InputEvent.Type keyDown

A keyboard key has been pressed.

keyTypedback to summary
public static final InputEvent.Type keyTyped

A keyboard key has been pressed and released.

keyUpback to summary
public static final InputEvent.Type keyUp

A keyboard key has been released.

mouseMovedback to summary
public static final InputEvent.Type mouseMoved

The mouse pointer has moved (without a mouse button being active).

scrolledback to summary
public static final InputEvent.Type scrolled

The mouse scroll wheel has changed.

touchDownback to summary
public static final InputEvent.Type touchDown

A new touch for a pointer on the stage was detected

touchDraggedback to summary
public static final InputEvent.Type touchDragged

A pointer that is touching the stage has moved.

touchUpback to summary
public static final InputEvent.Type touchUp

A pointer has stopped touching the stage.

Constructor Detail

Typeback to summary
private Type()

Method Detail

valueOfback to summary
public static InputEvent.Type valueOf(String name)
valuesback to summary
public static InputEvent.Type[] values()