Libraries.Game.DesktopInput Documentation

This class automatically handles input and notifies event listeners for Games running on Desktop platforms (e.g. Windows, Mac). Most users shouldn't need access to this class. For users who want to test input themselves at specific times, use an InputMonitor instead.

Inherits from: Libraries.Game.GameInput, Libraries.Game.StandardInput, Libraries.Language.Object

Actions Documentation

AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

AddGestureListener(Libraries.Interface.Events.GestureListener listener)

This action adds a GestureListener directly to the GameInput. Note that gestures aren't supported on desktop platforms - if the Game is running on a desktop platform, this action will be ignored.

Parameters

AddInputTable(Libraries.Game.InputTable table)

This action adds an InputTable to the GameInput. If at any point during the Game the currently focused Item has an input group that matches the identifier of the table, the table will be used to trigger Behaviors.

Parameters

AddKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)

This action will add a KeyboardListener to the DesktopInput. The DesktopInput will notify the KeyboardListener if keys are pressed on the keyboard. This action is automatically called by the Game class when needed.

Parameters

AddMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)

AddMouseListener(Libraries.Interface.Events.MouseListener listener)

This action adds a MouseListener directly to the GameInput. When the GameInput receives a mouse event, it will first check if any of the items added to the layers of the Game can handle the event - if none do, then all MouseListeners which are added directly to the GameInput will receive the event.

Parameters

AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action adds a MouseMovementListener directly to the GameInput. When the GameInput receives a mouse event, it will first check if any of the items added to the layers of the Game can handle the event - if none do, then all MouseMovementListeners which are added directly to the GameInput will receive the event.

Parameters

AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action adds a MouseWheelListener directly to the GameInput. When the GameInput receives a mouse event, it will first check if any of the items added to the layers of the Game can handle the event - if none do, then all MouseWheelListeners which are added directly to the GameInput will receive the event.

Parameters

AddResizeListener(Libraries.Interface.Events.ResizeListener listener)

This action will add a ResizeListener to the GameInput. The GameInput will notify the ResizeListener when the size of the game space changes, e.g. the window changes size or goes fullscreen.

Parameters

AddScreenshotListener(Libraries.Interface.Events.ScreenshotListener listener)

This action will add a ScreenshotListener to the GameInput. The GameInput will notify the ScreenshotListener when a screenshot is taken.

Parameters

AddSelectionListener(Libraries.Interface.Events.SelectionListener listener)

This action will add a SelectionListener to the GameInput. The GameInput will notify the SelectionListener whenever a selection changes.

Parameters

AddTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)

AddTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)

This action will add a TextChangeListener to the GameInput. The GameInput will notify the TextChangeListener whenever text changes, such as in a TextBox.

Parameters

AddTextInputListener(Libraries.Interface.Events.TextInputListener listener)

This action will add a TextInputListener to the DesktopInput. The DesktopInput will notify the TextInputListener when the user provides text input to the game via the keyboard.

Parameters

AddTouchListener(Libraries.Interface.Events.TouchListener listener)

This action adds a TouchListener directly to the GameInput. Note that touch isn't supported on desktop platforms - if the Game is running on a desktop platform, this action will be ignored.

Parameters

AddTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)

AddTreeTableChangeListener(Libraries.Interface.Events.TreeTableChangeListener listener)

AddWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Example

use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)

GetClickCount(Libraries.Interface.Item item)

This action returns how many times the particular item has been clicked with the mouse in a short period of time, as used to determine things like double click events. For desktop platforms, the period of time measured is based on the multiple click timer in the DesktopConfiguration. On platforms which don't support the mouse, this will always return 0.

Parameters

Return

integer: How many times the provided item has been recently clicked with the mouse.

GetDefaultInputTable()

This action returns the InputTable that the GameInput is using to automatically trigger Behaviors for certain input values.

Return

Libraries.Game.InputTable:

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetInputTable(text key)

This action retrieves an InputTable with the matching identifier from the GameInput (if there is one). If there is no InputTable with this identifier, the action will return undefined.

Parameters

  • text key

Return

Libraries.Game.InputTable:

GetKeyPressCount(integer keyCode)

This action returns how many times a particular key on the keyboard (as represented by its key code, found in the KeyboardEvent class) has been pressed in a short period of time. For desktop platforms, this period of time is measured based on the multiple key press timer in the DesktopConfiguration. On platforms that don't support multiple key press events, this will always return 0.

Parameters

  • integer keyCode: A key on the keyboard, represented by its integer key code.

Return

integer: How many times the given key has recently been pressed.

NotifyControlActivationListeners(Libraries.Interface.Events.ControlActivationEvent event)

NotifyMenuChangeListeners(Libraries.Interface.Events.MenuChangeEvent event)

NotifyScreenshotListeners(Libraries.Interface.Events.ScreenshotEvent event)

This action will notify all ScreenshotListeners which have been added to the GameInput of the given ScreenshotEvent. This is called automatically by the Game when a screenshot is taken, so most users will never need to call this action directly.

Parameters

NotifySelectionListeners(Libraries.Interface.Events.SelectionEvent event)

This action will notify all SelectionListeners which have been added to the GameInput of the given SelectionEvent.

Parameters

NotifyTabChangeListeners(Libraries.Interface.Events.TabChangeEvent event)

NotifyTextChangeListeners(Libraries.Interface.Events.TextChangeEvent event)

This action will notify all TextChangeListeners which have been added to the GameInput of the given TextChangeEvent.

Parameters

NotifyTreeChangeListeners(Libraries.Interface.Events.TreeChangeEvent event)

NotifyTreeTableChangeListeners(Libraries.Interface.Events.TreeTableChangeEvent event)

NotifyWindowFocusListeners(Libraries.Interface.Events.WindowFocusEvent event)

ProcessInputEvents()

This action will identify all input events that have occurred and notify all relevant event listeners. For certain kinds of input, e.g. mouse or touch input, only listeners that were added to the active panel will be notified. This action is called automatically by the Game class, so most users will never need to use this action directly.

RemoveControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

RemoveGestureListener(Libraries.Interface.Events.GestureListener listener)

This action removes a GestureListener from the GameInput. Note that gestures aren't supported on desktop platforms - if the Game is running on a desktop platform, this action will be ignored.

Parameters

RemoveInputTable(text key)

This action removes the InputTable with the matching identifier from the GameInput (if there is one). If the InputTable is found, it will be returned - otherwise, the action returns undefined.

Parameters

  • text key

Return

Libraries.Game.InputTable:

RemoveKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)

This action will remove a KeyboardListener from the DesktopInput. The DesktopInput will no longer notify the given KeyboardListener of KeyboardEvents. This action is automatically called by the Game class when needed.

Parameters

RemoveMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)

RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)

This action removes a MouseListener from the GameInput. It will no longer receive mouse events directly from the GameInput.

Parameters

RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action removes a MouseMovementListener from the GameInput. The listener will no longer receive events from the GameInput.

Parameters

RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action removes a MouseWheelListener from the GameInput. The listener will no longer receive events from the GameInput.

Parameters

RemoveResizeListener(Libraries.Interface.Events.ResizeListener listener)

This action will remove a ResizeListener from the GameInput. The GameInput will no longer notify the given ResizeListener of ResizeEvents.

Parameters

RemoveScreenshotListener(Libraries.Interface.Events.ScreenshotListener listener)

This action will remove a ScreenshotListener from the GameInput. The GameInput will no longer notify the given listener when screenshots occur.

Parameters

RemoveSelectionListener(Libraries.Interface.Events.SelectionListener listener)

This action will remove a SelectionListener from the GameInput. The GameInput will no longer notify the given SelectionListener of selection changes.

Parameters

RemoveTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)

RemoveTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)

This action will remove a TextChangeListener from the GameInput. The GameInput will no longer notify the given TextChangeListener of text changes.

Parameters

RemoveTextInputListener(Libraries.Interface.Events.TextInputListener listener)

This action will remove a TextInputListener from the DesktopInput. The DesktopInput will no longer notify the given TextInputListener of TextInputEvents.

Parameters

RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)

This action removes a TouchListener from the GameInput. Note that touch isn't supported on desktop platforms - if the Game is running on a desktop platform, this action will be ignored.

Parameters

RemoveTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)

RemoveTreeTableChangeListener(Libraries.Interface.Events.TreeTableChangeListener listener)

RemoveWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)

SetDefaultInputTable(Libraries.Game.InputTable inputTable)

This action sets the InputTable to be used by this GameInput. When the Game receives input, the GameInput will automatically trigger Behaviors from the InputTable.

Parameters

SetLayers(Libraries.Containers.Array<Libraries.Game.Layer> array)

This action sets a reference to the layers stored in the Game class that the GameInput needs to test input on. This action is automatically called by the Game, and should never be used by users directly.

Parameters