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.Language.Object

Summary

Actions Summary Table

ActionsDescription
AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)
AddInputTable(Libraries.Game.InputTable table)This action adds an InputTable to the GameInput.
AddKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)This action will add a KeyboardListener to the DesktopInput.
AddMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)
AddMouseListener(Libraries.Interface.Events.MouseListener listener)This action adds a MouseListener directly to the GameInput.
AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action adds a MouseMovementListener directly to the GameInput.
AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action adds a MouseWheelListener directly to the GameInput.
AddResizeListener(Libraries.Interface.Events.ResizeListener listener)This action will add a ResizeListener to the GameInput.
AddSelectionListener(Libraries.Interface.Events.SelectionListener listener)This action will add a SelectionListener to the GameInput.
AddTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)
AddTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)This action will add a TextChangeListener to the GameInput.
AddTextInputListener(Libraries.Interface.Events.TextInputListener listener)This action will add a TextInputListener to the DesktopInput.
AddTouchListener(Libraries.Interface.Events.TouchListener listener)This action adds a TouchListener directly to the GameInput.
AddTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)
AddWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetDefaultInputTable()This action returns the InputTable that the GameInput is using to automatically trigger Behaviors for certain input values.
GetHashCode()This action gets the hash code for an object.
GetInputTable(text key)This action retrieves an InputTable with the matching identifier from the GameInput (if there is one).
NotifyControlActivationListeners(Libraries.Interface.Events.ControlActivationEvent event)
NotifyMenuChangeListeners(Libraries.Interface.Events.MenuChangeEvent event)
NotifySelectionListeners(Libraries.Interface.Events.SelectionEvent event)This action will notify all SelectionListeners which have been added to the GameInput of the given SelectionEvent.
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.
NotifyTreeChangeListeners(Libraries.Interface.Events.TreeChangeEvent event)
NotifyWindowFocusListeners(Libraries.Interface.Events.WindowFocusEvent event)
ProcessInputEvents()This action will identify all input events that have occurred and notify all relevant event listeners.
RemoveControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)
RemoveInputTable(text key)This action removes the InputTable with the matching identifier from the GameInput (if there is one).
RemoveKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)This action will remove a KeyboardListener from the DesktopInput.
RemoveMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)
RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)This action removes a MouseListener from the GameInput.
RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action removes a MouseMovementListener from the GameInput.
RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action removes a MouseWheelListener from the GameInput.
RemoveResizeListener(Libraries.Interface.Events.ResizeListener listener)This action will remove a ResizeListener from the GameInput.
RemoveSelectionListener(Libraries.Interface.Events.SelectionListener listener)This action will remove a SelectionListener from the GameInput.
RemoveTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)
RemoveTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)This action will remove a TextChangeListener from the GameInput.
RemoveTextInputListener(Libraries.Interface.Events.TextInputListener listener)This action will remove a TextInputListener from the DesktopInput.
RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)This action removes a TouchListener from the GameInput.
RemoveTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)
RemoveWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)
SetDefaultInputTable(Libraries.Game.InputTable inputTable)This action sets the InputTable to be used by this GameInput.
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.

Actions Documentation

AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

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)

Parameters

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

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)

Parameters

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)

Parameters

AddWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

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

Example Code

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

Parameters

Return

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

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.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

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

Return

Libraries.Game.InputTable:

NotifyControlActivationListeners(Libraries.Interface.Events.ControlActivationEvent event)

Parameters

NotifyMenuChangeListeners(Libraries.Interface.Events.MenuChangeEvent event)

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)

Parameters

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)

Parameters

NotifyWindowFocusListeners(Libraries.Interface.Events.WindowFocusEvent event)

Parameters

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)

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

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)

Parameters

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

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)

Parameters

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)

Parameters

RemoveWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)

Parameters

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