Class GUIEvent

java.lang.Object
com.blackrook.gui.GUIEvent
All Implemented Interfaces:
GUIInputConstants

public final class GUIEvent extends Object implements GUIInputConstants
Event class for things that happen in the GUI. Be warned that event objects may be pooled - this should only be used for feedback purposes. Do not store references to these objects, as they be may be reused by the GUI system. They are also NOT THREAD-SAFE.
Author:
Matthew Tropiano
See Also:
  • Method Details

    • getGUI

      public GUI getGUI()
      Returns:
      a reference to the GUI node that this event happened on.
    • getObject

      public GUIObject getObject()
      Returns a reference to the object that is the source of this event. May be null if this event was not fired by an object.
      Returns:
      the object.
    • getType

      public String getType()
      Returns:
      the type of event that this is.
    • getOrigin

      public GUIEvent.Origin getOrigin()
      Returns:
      what system originated this event.
    • isRelease

      public boolean isRelease()
      Returns:
      true if this is a key/button release event, false if not, or it's a press.
    • isGenericInputEvent

      public boolean isGenericInputEvent()
      Is this event a generic input event?
      Returns:
      true if so, false if not.
    • isKeyboardEvent

      public boolean isKeyboardEvent()
      Is this event a keyboard event?
      Returns:
      true if so, false if not.
    • isMouseEvent

      public boolean isMouseEvent()
      Is this event a mouse event?
      Returns:
      true if so, false if not.
    • isMouseWheelEvent

      public boolean isMouseWheelEvent()
      Is this event a mouse wheel event?
      Returns:
      true if so, false if not.
    • isGamepadEvent

      public boolean isGamepadEvent()
      Is this event a gamepad axis event?
      Returns:
      true if so, false if not.
    • isGamepadAxisEvent

      public boolean isGamepadAxisEvent()
      Is this event a gamepad axis event?
      Returns:
      true if so, false if not.
    • isGamepadAxisTapEvent

      public boolean isGamepadAxisTapEvent()
      Is this event a gamepad axis tap event?
      Returns:
      true if so, false if not.
    • isObjectEvent

      public boolean isObjectEvent()
      Is this event an object event?
      Returns:
      true if so, false if not.
    • getCode

      public int getCode()
      Returns the code associated with this event, if this was a generic event. If this is NOT a GENERIC event, this returns -1.
      Returns:
      the input code.
    • getKeyModifier

      public int getKeyModifier()
      Returns:
      the key modifier mask associated with this event.
    • getKeyCode

      public int getKeyCode()
      Returns the key code associated with this event, if this was a keyboard event. If this is NOT a keyboard event, this returns -1.
      Returns:
      the key code.
    • getMouseButton

      public int getMouseButton()
      Returns the mouse button associated with this event, if this was a mouse event. If this is NOT a mouse event, this returns -1.
      Returns:
      the mouse button.
    • getMousePositionX

      public int getMousePositionX()
      Returns the mouse cursor position, x-axis, associated with this event, if this was a mouse event. This is in units native to the GUI system!
      Returns:
      the mouse position.
    • getMousePositionY

      public int getMousePositionY()
      Returns the mouse cursor position, y-axis, associated with this event, if this was a mouse event. This is in units native to the GUI system!
      Returns:
      the mouse position.
    • getMouseMovementX

      public int getMouseMovementX()
      Returns the amount of units that the mouse moved, x-axis, associated with this event, if this was a mouse event. This is in units native to the GUI system!
      Returns:
      the mouse movement units.
    • getMouseMovementY

      public int getMouseMovementY()
      Returns the amount of units that the mouse moved, y-axis, associated with this event, if this was a mouse event. This is in units native to the GUI system!
      Returns:
      the mouse movement units.
    • getMouseObjectPositionX

      public int getMouseObjectPositionX()
      Returns the mouse cursor position inside the current object that it is over, x-axis, associated with this event, if this was a mouse event. This is in units native to the GUI system!
      Returns:
      the mouse object position.
    • getMouseObjectPositionY

      public int getMouseObjectPositionY()
      Returns the mouse cursor position inside the current object that it is over, y-axis, associated with this event, if this was a mouse event. This is in units native to the GUI system!
      Returns:
      the mouse object position.
    • getMouseWheelMovement

      public int getMouseWheelMovement()
      Returns the amount of units that the mouse wheel moved, if this is a mouse wheel event. If this is NOT a mouse wheel event, this returns 0.
      Returns:
      the mouse wheel movement amount.
    • getGamepadId

      public int getGamepadId()
      Returns the id of the controller that this event happened on. If this is NOT a gamepad event, the returns -1.
      Returns:
      the mouse wheel movement amount.
    • getGamepadAxisId

      public int getGamepadAxisId()
      Returns the axis on the controller that this event happened on. If this is NOT a gamepad event, the returns GUIInputConstants.AXIS_UNDEFINED.
      Returns:
      the axis id.
    • getGamepadButton

      public int getGamepadButton()
      Returns the axis on the controller that this event happened on. If this is NOT a gamepad event, the returns GUIInputConstants.GAMEPAD_UNDEFINED.
      Returns:
      the gamepad button.
    • getGamepadAxisValue

      public float getGamepadAxisValue()
      Returns the value on the controller axis that this event happened on. If this is NOT a gamepad axis event, the returns 0f.
      Returns:
      the gamepad axis value.
    • getGamepadAxisTapValue

      public boolean getGamepadAxisTapValue()
      Returns the positivity on the controller axis that a tap event happened on. If this is NOT a gamepad axis tap event, the returns false.
      Returns:
      the gamepad axis tap value.