Class InputEvent

java.lang.Object
com.prineside.tdi2.scene2d.Event
com.prineside.tdi2.scene2d.InputEvent
All Implemented Interfaces:
Pool.Poolable

public class InputEvent extends Event
Event for actor input: touch, mouse, touch/mouse actor enter/exit, mouse scroll, and keyboard events.
See Also:
  • 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 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:
    • 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

      @Null 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(@Null 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 if this event is a touchUp triggered by Stage.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

      public String toString()
      Overrides:
      toString in class Object