Package com.prineside.tdi2.scene2d
Class InputEvent
java.lang.Object
com.prineside.tdi2.scene2d.Event
com.prineside.tdi2.scene2d.InputEvent
- All Implemented Interfaces:
Pool.Poolable
Event for actor input: touch, mouse, touch/mouse actor enter/exit, mouse scroll, and keyboard events.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Types of low-level input events supported by scene2d. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
The index for the mouse button pressed.char
The character for the key that was typed.int
The key code of the key that was pressed.int
The pointer index for the event.The actor related to the event.float
The amount the mouse was scrolled horizontally.float
The amount the mouse was scrolled vertically.float
The stage x coordinate where the event occurred.float
The stage x coordinate where the event occurred.boolean
If false,InputListener.handle(Event)
will not add the listener to the stage's touch focus when a touch down event is handled.getType()
The type of input event.boolean
Returns true if this event is a touchUp triggered byStage.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
setScrollAmountX
(float scrollAmount) void
setScrollAmountY
(float scrollAmount) void
setStageX
(float stageX) void
setStageY
(float stageY) void
setTouchFocus
(boolean touchFocus) void
setType
(InputEvent.Type type) toCoordinates
(Actor actor, Vector2 actorCoords) Sets actorCoords to this event's coordinates relative to the specified actor.toString()
Methods inherited from class com.prineside.tdi2.scene2d.Event
cancel, getBubbles, getListenerActor, getStage, getTarget, halt, handle, isCancelled, isCapture, isHalted, isHandled, isStopped, setBubbles, setCapture, setListenerActor, setStage, setTarget, stop
-
Constructor Details
-
InputEvent
public InputEvent()
-
-
Method Details
-
reset
public void reset()Description copied from interface:com.badlogic.gdx.utils.Pool.Poolable
Resets the object for reuse. Object references should be nulled and fields may be set to default values.- Specified by:
reset
in interfacePool.Poolable
- Overrides:
reset
in classEvent
-
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
The type of input event. -
setType
-
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:
-
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 typed. Valid for: keyTyped. -
setCharacter
public void setCharacter(char character) -
getScrollAmountX
public float getScrollAmountX()The amount the mouse was scrolled horizontally. Valid for: scrolled. -
getScrollAmountY
public float getScrollAmountY()The amount the mouse was scrolled vertically. Valid for: scrolled. -
setScrollAmountX
public void setScrollAmountX(float scrollAmount) -
setScrollAmountY
public void setScrollAmountY(float scrollAmount) -
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
- Parameters:
relatedActor
- May be null.
-
toCoordinates
Sets actorCoords to this event's coordinates relative to the specified actor.- Parameters:
actorCoords
- Output for resulting coordinates.
-
isTouchFocusCancel
public boolean isTouchFocusCancel()Returns true if this event is a touchUp triggered byStage.cancelTouchFocus()
. -
getTouchFocus
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. -
setTouchFocus
public void setTouchFocus(boolean touchFocus) -
toString
-