Class GUIEvent
java.lang.Object
com.blackrook.gui.GUIEvent
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface GUIInputConstants
AXIS_POV, AXIS_POV_DOWN, AXIS_POV_DOWN_LEFT, AXIS_POV_DOWN_RIGHT, AXIS_POV_LEFT, AXIS_POV_RIGHT, AXIS_POV_UP, AXIS_POV_UP_LEFT, AXIS_POV_UP_RIGHT, AXIS_RX, AXIS_RY, AXIS_RZ, AXIS_SLIDER, AXIS_TAP_NEGATIVE, AXIS_TAP_POSITIVE, AXIS_UNDEFINED, AXIS_X, AXIS_XBOX_LEFT_X, AXIS_XBOX_LEFT_Y, AXIS_XBOX_PAD, AXIS_XBOX_RIGHT_X, AXIS_XBOX_RIGHT_Y, AXIS_XBOX_TRIGGER, AXIS_Y, AXIS_Z, GAMEPAD_1, GAMEPAD_10, GAMEPAD_11, GAMEPAD_12, GAMEPAD_2, GAMEPAD_3, GAMEPAD_4, GAMEPAD_5, GAMEPAD_6, GAMEPAD_7, GAMEPAD_8, GAMEPAD_9, GAMEPAD_UNDEFINED, GAMEPAD_XBOX_A, GAMEPAD_XBOX_B, GAMEPAD_XBOX_BACK, GAMEPAD_XBOX_LB, GAMEPAD_XBOX_LSTICK, GAMEPAD_XBOX_RB, GAMEPAD_XBOX_RSTICK, GAMEPAD_XBOX_START, GAMEPAD_XBOX_X, GAMEPAD_XBOX_Y, KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, KEY_ACCEPT, KEY_ADD, KEY_AGAIN, KEY_ALL_CANDIDATES, KEY_ALPHANUMERIC, KEY_ALT, KEY_ALT_GRAPH, KEY_AMPERSAND, KEY_ASTERISK, KEY_AT, KEY_B, KEY_BACK_QUOTE, KEY_BACK_SLASH, KEY_BACK_SPACE, KEY_BEGIN, KEY_BRACELEFT, KEY_BRACERIGHT, KEY_C, KEY_CANCEL, KEY_CAPS_LOCK, KEY_CIRCUMFLEX, KEY_CLEAR, KEY_CLOSE_BRACKET, KEY_CODE_INPUT, KEY_COLON, KEY_COMMA, KEY_COMPOSE, KEY_CONTEXT_MENU, KEY_CONTROL, KEY_CONVERT, KEY_COPY, KEY_CUT, KEY_D, KEY_DEAD_ABOVEDOT, KEY_DEAD_ABOVERING, KEY_DEAD_ACUTE, KEY_DEAD_BREVE, KEY_DEAD_CARON, KEY_DEAD_CEDILLA, KEY_DEAD_CIRCUMFLEX, KEY_DEAD_DIAERESIS, KEY_DEAD_DOUBLEACUTE, KEY_DEAD_GRAVE, KEY_DEAD_IOTA, KEY_DEAD_MACRON, KEY_DEAD_OGONEK, KEY_DEAD_SEMIVOICED_SOUND, KEY_DEAD_TILDE, KEY_DEAD_VOICED_SOUND, KEY_DECIMAL, KEY_DELETE, KEY_DIVIDE, KEY_DOLLAR, KEY_DOWN, KEY_E, KEY_END, KEY_ENTER, KEY_EQUALS, KEY_ESCAPE, KEY_EURO_SIGN, KEY_EXCLAMATION_MARK, KEY_F, KEY_F1, KEY_F10, KEY_F11, KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F2, KEY_F20, KEY_F21, KEY_F22, KEY_F23, KEY_F24, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_FINAL, KEY_FIND, KEY_FULL_WIDTH, KEY_G, KEY_GREATER, KEY_H, KEY_HALF_WIDTH, KEY_HELP, KEY_HIRAGANA, KEY_HOME, KEY_I, KEY_INPUT_METHOD_ON_OFF, KEY_INSERT, KEY_INVERTED_EXCLAMATION_MARK, KEY_J, KEY_JAPANESE_HIRAGANA, KEY_JAPANESE_KATAKANA, KEY_JAPANESE_ROMAN, KEY_K, KEY_KANA, KEY_KANA_LOCK, KEY_KANJI, KEY_KATAKANA, KEY_KP_DOWN, KEY_KP_LEFT, KEY_KP_RIGHT, KEY_KP_UP, KEY_L, KEY_LEFT, KEY_LEFT_PARENTHESIS, KEY_LESS, KEY_M, KEY_META, KEY_MINUS, KEY_MODECHANGE, KEY_MULTIPLY, KEY_N, KEY_NONCONVERT, KEY_NUM_LOCK, KEY_NUMBER_SIGN, KEY_NUMPAD0, KEY_NUMPAD1, KEY_NUMPAD2, KEY_NUMPAD3, KEY_NUMPAD4, KEY_NUMPAD5, KEY_NUMPAD6, KEY_NUMPAD7, KEY_NUMPAD8, KEY_NUMPAD9, KEY_O, KEY_OPEN_BRACKET, KEY_P, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_PASTE, KEY_PAUSE, KEY_PERIOD, KEY_PLUS, KEY_PREVIOUS_CANDIDATE, KEY_PRINTSCREEN, KEY_PROPS, KEY_Q, KEY_QUOTE, KEY_QUOTEDBL, KEY_R, KEY_RIGHT, KEY_RIGHT_PARENTHESIS, KEY_ROMAN_CHARACTERS, KEY_S, KEY_SCROLL_LOCK, KEY_SEMICOLON, KEY_SEPARATER, KEY_SEPARATOR, KEY_SHIFT, KEY_SLASH, KEY_SPACE, KEY_STOP, KEY_SUBTRACT, KEY_T, KEY_TAB, KEY_U, KEY_UNDEFINED, KEY_UNDERSCORE, KEY_UNDO, KEY_UP, KEY_V, KEY_W, KEY_WINDOWS, KEY_X, KEY_Y, KEY_Z, MOUSE_BACK, MOUSE_BUTTON1, MOUSE_BUTTON10, MOUSE_BUTTON11, MOUSE_BUTTON12, MOUSE_BUTTON2, MOUSE_BUTTON3, MOUSE_BUTTON4, MOUSE_BUTTON5, MOUSE_BUTTON6, MOUSE_BUTTON7, MOUSE_BUTTON8, MOUSE_BUTTON9, MOUSE_CENTER, MOUSE_FORWARD, MOUSE_LEFT, MOUSE_RIGHT, MOUSE_UNDEFINED -
Method Summary
Modifier and TypeMethodDescriptionintgetCode()Returns the code associated with this event, if this was a generic event.intReturns the axis on the controller that this event happened on.booleanReturns the positivity on the controller axis that a tap event happened on.floatReturns the value on the controller axis that this event happened on.intReturns the axis on the controller that this event happened on.intReturns the id of the controller that this event happened on.getGUI()intReturns the key code associated with this event, if this was a keyboard event.intintReturns the mouse button associated with this event, if this was a mouse event.intReturns the amount of units that the mouse moved, x-axis, associated with this event, if this was a mouse event.intReturns the amount of units that the mouse moved, y-axis, associated with this event, if this was a mouse event.intReturns the mouse cursor position inside the current object that it is over, x-axis, associated with this event, if this was a mouse event.intReturns the mouse cursor position inside the current object that it is over, y-axis, associated with this event, if this was a mouse event.intReturns the mouse cursor position, x-axis, associated with this event, if this was a mouse event.intReturns the mouse cursor position, y-axis, associated with this event, if this was a mouse event.intReturns the amount of units that the mouse wheel moved, if this is a mouse wheel event.Returns a reference to the object that is the source of this event.getType()booleanIs this event a gamepad axis event?booleanIs this event a gamepad axis tap event?booleanIs this event a gamepad axis event?booleanIs this event a generic input event?booleanIs this event a keyboard event?booleanIs this event a mouse event?booleanIs this event a mouse wheel event?booleanIs this event an object event?boolean
-
Method Details
-
getGUI
- Returns:
- a reference to the GUI node that this event happened on.
-
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
- Returns:
- the type of event that this is.
-
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 returnsGUIInputConstants.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 returnsGUIInputConstants.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.
-