Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Input Class Reference

Input polling functions. More...

Public Member Functions

decimal GetMouseX ()
 Gets cursor's X position.
decimal GetMouseY ()
 Gets cursor's Y position.
boolean IsMouseButtonDown (integer mouseButtonID)
 Gets whether the mouse button is currently down.
boolean IsMouseButtonPressed (integer mouseButtonID)
 Gets whether the mouse button started pressing during the current frame.
boolean IsMouseButtonReleased (integer mouseButtonID)
 Gets whether the mouse button released during the current frame.
MOUSEMODE GetMouseMode ()
 Gets the current mouse mode.
void SetMouseMode (MOUSEMODE mouseMode)
 Sets the current mouse mode.
boolean IsKeyDown (Key keyID)
 Gets whether the key is currently down.
boolean IsKeyPressed (Key keyID)
 Gets whether the key started pressing during the current frame.
boolean IsKeyReleased (Key keyID)
 Gets whether the key released during the current frame.
string GetKeyName (Key keyID)
 Gets the name of the key.
string GetButtonName (Button button)
 Gets the name of the button.
string GetAxisName (Axis axis)
 Gets the name of the axis.
Key ParseKeyName (string keyName)
 Parses a string into a Key.
Button ParseButtonName (string buttonName)
 Parses a string into a Button.
Axis ParseAxisName (string axisName)
 Parses a string into an Axis.
array GetActionList ()
 Gets a list of all input actions.
boolean ActionExists (string actionName)
 Gets whether the given input action exists.
boolean IsActionHeld (integer playerID, string actionName, InputDevice inputDevice)
 Gets whether the input action is currently held for the specified player.
boolean IsActionPressed (integer playerID, string actionName, InputDevice inputDevice)
 Gets whether the input action is currently pressed for the specified player.
boolean IsActionReleased (integer playerID, string actionName, InputDevice inputDevice)
 Gets whether the input action was released for the specified player.
boolean IsActionHeldByAny (string actionName, InputDevice inputDevice)
 Gets whether the input action is currently held by any player.
boolean IsActionPressedByAny (string actionName, InputDevice inputDevice)
 Gets whether the input action is currently pressed by any player.
boolean IsActionReleasedByAny (string actionName, InputDevice inputDevice)
 Gets whether the input action was released by any player.
boolean IsAnyActionHeld (integer playerID, InputDevice inputDevice)
 Gets whether any input action is currently held for the specified player.
boolean IsAnyActionPressed (integer playerID, InputDevice inputDevice)
 Gets whether any input action is currently pressed for the specified player.
boolean IsAnyActionReleased (integer playerID, InputDevice inputDevice)
 Gets whether any input action was released for the specified player.
boolean IsAnyActionHeldByAny (InputDevice inputDevice)
 Gets whether any input action is currently held by any player.
boolean IsAnyActionPressedByAny (InputDevice inputDevice)
 Gets whether any input action is currently pressed by any player.
boolean IsAnyActionReleasedByAny (InputDevice inputDevice)
 Gets whether any input action was released by any player.
decimal GetAnalogActionInput (integer playerID, string actionName)
 Gets the analog value of a specific action.
map GetActionBind (integer playerID, string actionName, integer bindIndex)
 Gets the bound input action for a specific player.
void SetActionBind (integer playerID, string actionName, InputBind inputBindType, enum actionBind, integer bindIndex)
 Binds an input action for a specific player.
void SetActionBind (integer playerID, string actionName, InputBind inputBindType, map actionBind, integer bindIndex)
 Binds an input action for a specific player.
integer AddActionBind (integer playerID, string actionName, InputBind inputBindType, enum actionBind)
 Adds an input action bind for a specific player.
integer AddActionBind (integer playerID, string actionName, InputBind inputBindType, map actionBind)
 Adds an input action bind for a specific player.
void RemoveActionBind (integer playerID, string actionName, integer bindIndex)
 Removes a bound input action from a specific player.
array GetBoundActionList (integer playerID, string actionName)
 Gets a list of the input actions currently bound to a specific player.
integer GetBoundActionCount (integer playerID, string actionName)
 Gets the amount of bound input actions for a specific player.
map GetBoundActionMap (integer playerID)
 Gets a map of the input actions currently bound to a specific player.
map GetDefaultActionBind (integer playerID, string actionName, integer bindIndex)
 Gets the default bound input action for a specific player.
void SetDefaultActionBind (integer playerID, string actionName, InputBind inputBindType, enum actionBind, integer bindIndex)
 Binds a default input action for a specific player.
void SetDefaultActionBind (integer playerID, string actionName, InputBind inputBindType, map actionBind, integer bindIndex)
 Binds a default input action for a specific player.
integer AddDefaultActionBind (integer playerID, string actionName, InputBind inputBindType, enum actionBind)
 Adds a default input action bind for a specific player.
void RemoveDefaultActionBind (integer playerID, string actionName, integer bindIndex)
 Removes a bound input action default from a specific player.
array GetDefaultBoundActionList (integer playerID, string actionName)
 Gets a list of the input actions bound by default to a specific player.
integer GetDefaultBoundActionCount (integer playerID, string actionName)
 Gets the amount of bound default input actions for a specific player.
map GetDefaultBoundActionMap (integer playerID)
 Gets a map of the input actions bound by default to a specific player.
void ResetActionBindsToDefaults (integer playerID)
 Sets all input actions for a specific player to its defaults.
boolean IsPlayerUsingDevice (integer playerID, InputDevice inputDevice)
 Checks if a given input device is being used by the player.
index GetPlayerControllerIndex (integer playerID)
 Gets the controller index assigned to a specific player.
void SetPlayerControllerIndex (integer playerID, integer controllerID)
 Assigns a controller index to a specific player.

Detailed Description

Input polling functions.

This class also houses the input action system.

Member Function Documentation

◆ ActionExists()

boolean Input.ActionExists ( string actionName)

Gets whether the given input action exists.

Parameters
actionNameName of the action to check.
Returns
Returns a boolean value.

◆ AddActionBind() [1/2]

integer Input.AddActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
enum actionBind )

Adds an input action bind for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action.
inputBindTypeThe input bind type.
actionBindThe bind definition.
Returns
Returns the index of the added input action as an integer value.

◆ AddActionBind() [2/2]

integer Input.AddActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
map actionBind )

Adds an input action bind for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action.
inputBindTypeThe input bind type.
actionBindThe bind definition.
Returns
Returns the index of the added input action as an integer value.

◆ AddDefaultActionBind()

integer Input.AddDefaultActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
enum actionBind )

Adds a default input action bind for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action.
inputBindTypeThe input bind type.
actionBindThe bind definition.
Returns
Returns the index of the added input action as an integer value.

◆ GetActionBind()

map Input.GetActionBind ( integer playerID,
string actionName,
integer bindIndex )

Gets the bound input action for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to get.
bindIndexWhich bind index to get.
Returns
Returns a map value, or null if the input action is not bound.

◆ GetActionList()

array Input.GetActionList ( )

Gets a list of all input actions.

Returns
Returns an array value, or null if no actions are registered.

◆ GetAnalogActionInput()

decimal Input.GetAnalogActionInput ( integer playerID,
string actionName )

Gets the analog value of a specific action.

Parameters
playerIDIndex of the player to check.
actionNameName of the action to check.
Returns
Returns a decimal value.

◆ GetAxisName()

string Input.GetAxisName ( Axis axis)

Gets the name of the axis.

Parameters
axisWhich axis to check.
Returns
Returns a string value.

◆ GetBoundActionCount()

integer Input.GetBoundActionCount ( integer playerID,
string actionName )

Gets the amount of bound input actions for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action.
Returns
Returns an integer value.

◆ GetBoundActionList()

array Input.GetBoundActionList ( integer playerID,
string actionName )

Gets a list of the input actions currently bound to a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to get.
Returns
Returns an array of map values.

◆ GetBoundActionMap()

map Input.GetBoundActionMap ( integer playerID)

Gets a map of the input actions currently bound to a specific player.

Parameters
playerIDIndex of the player.
Returns
Returns a map value, or null if no actions are registered.

◆ GetButtonName()

string Input.GetButtonName ( Button button)

Gets the name of the button.

Parameters
buttonWhich button to check.
Returns
Returns a string value.

◆ GetDefaultActionBind()

map Input.GetDefaultActionBind ( integer playerID,
string actionName,
integer bindIndex )

Gets the default bound input action for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to get.
bindIndexWhich bind index to get.
Returns
Returns a map value, or null if the input action is not bound.

◆ GetDefaultBoundActionCount()

integer Input.GetDefaultBoundActionCount ( integer playerID,
string actionName )

Gets the amount of bound default input actions for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action.
Returns
Returns an integer value.

◆ GetDefaultBoundActionList()

array Input.GetDefaultBoundActionList ( integer playerID,
string actionName )

Gets a list of the input actions bound by default to a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to get.
Returns
Returns an array of map values.

◆ GetDefaultBoundActionMap()

map Input.GetDefaultBoundActionMap ( integer playerID)

Gets a map of the input actions bound by default to a specific player.

Parameters
playerIDIndex of the player.
Returns
Returns a map value, or null if no actions are registered.

◆ GetKeyName()

string Input.GetKeyName ( Key keyID)

Gets the name of the key.

Parameters
keyIDThe key ID to check.
Returns
Returns a string value.

◆ GetMouseMode()

MOUSEMODE Input.GetMouseMode ( )

Gets the current mouse mode.

Returns
Returns the current mouse mode.

◆ GetMouseX()

decimal Input.GetMouseX ( )

Gets cursor's X position.

Returns
Returns cursor's X position in relation to the window.

◆ GetMouseY()

decimal Input.GetMouseY ( )

Gets cursor's Y position.

Returns
Returns cursor's Y position in relation to the window.

◆ GetPlayerControllerIndex()

index Input.GetPlayerControllerIndex ( integer playerID)

Gets the controller index assigned to a specific player.

Parameters
playerIDIndex of the player to check.
Returns
Returns the index of the controller, or -1 if there is no controller assigned.

◆ IsActionHeld()

boolean Input.IsActionHeld ( integer playerID,
string actionName,
InputDevice inputDevice )

Gets whether the input action is currently held for the specified player.

Parameters
playerIDIndex of the player to check.
actionNameName of the action to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsActionHeldByAny()

boolean Input.IsActionHeldByAny ( string actionName,
InputDevice inputDevice )

Gets whether the input action is currently held by any player.

Parameters
actionNameName of the action to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsActionPressed()

boolean Input.IsActionPressed ( integer playerID,
string actionName,
InputDevice inputDevice )

Gets whether the input action is currently pressed for the specified player.

Parameters
playerIDIndex of the player to check.
actionNameName of the action to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsActionPressedByAny()

boolean Input.IsActionPressedByAny ( string actionName,
InputDevice inputDevice )

Gets whether the input action is currently pressed by any player.

Parameters
actionNameName of the action to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsActionReleased()

boolean Input.IsActionReleased ( integer playerID,
string actionName,
InputDevice inputDevice )

Gets whether the input action was released for the specified player.

Parameters
playerIDIndex of the player to check.
actionNameName of the action to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsActionReleasedByAny()

boolean Input.IsActionReleasedByAny ( string actionName,
InputDevice inputDevice )

Gets whether the input action was released by any player.

Parameters
actionNameName of the action to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsAnyActionHeld()

boolean Input.IsAnyActionHeld ( integer playerID,
InputDevice inputDevice )

Gets whether any input action is currently held for the specified player.

Parameters
playerIDIndex of the player to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsAnyActionHeldByAny()

boolean Input.IsAnyActionHeldByAny ( InputDevice inputDevice)

Gets whether any input action is currently held by any player.

Parameters
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsAnyActionPressed()

boolean Input.IsAnyActionPressed ( integer playerID,
InputDevice inputDevice )

Gets whether any input action is currently pressed for the specified player.

Parameters
playerIDIndex of the player to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsAnyActionPressedByAny()

boolean Input.IsAnyActionPressedByAny ( InputDevice inputDevice)

Gets whether any input action is currently pressed by any player.

Parameters
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsAnyActionReleased()

boolean Input.IsAnyActionReleased ( integer playerID,
InputDevice inputDevice )

Gets whether any input action was released for the specified player.

Parameters
playerIDIndex of the player to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsAnyActionReleasedByAny()

boolean Input.IsAnyActionReleasedByAny ( InputDevice inputDevice)

Gets whether any input action was released by any player.

Parameters
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ IsKeyDown()

boolean Input.IsKeyDown ( Key keyID)

Gets whether the key is currently down.

Parameters
keyIDThe key ID to check.
Returns
Returns whether the key is currently down.

◆ IsKeyPressed()

boolean Input.IsKeyPressed ( Key keyID)

Gets whether the key started pressing during the current frame.

Parameters
keyIDThe key ID to check.
Returns
Returns whether the key started pressing during the current frame.

◆ IsKeyReleased()

boolean Input.IsKeyReleased ( Key keyID)

Gets whether the key released during the current frame.

Parameters
keyIDThe key ID to check.
Returns
Returns whether the key released during the current frame.

◆ IsMouseButtonDown()

boolean Input.IsMouseButtonDown ( integer mouseButtonID)

Gets whether the mouse button is currently down.


Mouse Button Indexes:

  • 0: Left
  • 1: Middle
  • 2: Right
Parameters
mouseButtonIDIndex of the mouse button to check.
Returns
Returns whether the mouse button is currently down.

◆ IsMouseButtonPressed()

boolean Input.IsMouseButtonPressed ( integer mouseButtonID)

Gets whether the mouse button started pressing during the current frame.


Mouse Button Indexes:

  • 0: Left
  • 1: Middle
  • 2: Right
Parameters
mouseButtonIDIndex of the mouse button to check.
Returns
Returns whether the mouse button started pressing during the current frame.

◆ IsMouseButtonReleased()

boolean Input.IsMouseButtonReleased ( integer mouseButtonID)

Gets whether the mouse button released during the current frame.


Mouse Button Indexes:

  • 0: Left
  • 1: Middle
  • 2: Right
Parameters
mouseButtonIDIndex of the mouse button to check.
Returns
Returns whether the mouse button released during the current frame.

◆ IsPlayerUsingDevice()

boolean Input.IsPlayerUsingDevice ( integer playerID,
InputDevice inputDevice )

Checks if a given input device is being used by the player.

Parameters
playerIDIndex of the player to check.
inputDeviceWhich input device to check.
Returns
Returns a boolean value.

◆ ParseAxisName()

Axis Input.ParseAxisName ( string axisName)

Parses a string into an Axis.

Parameters
axisNameThe axis name to parse.
Returns
Returns the parsed axis, or null if it could not be parsed.

◆ ParseButtonName()

Button Input.ParseButtonName ( string buttonName)

Parses a string into a Button.

Parameters
buttonNameThe button name to parse.
Returns
Returns the parsed button, or null if it could not be parsed.

◆ ParseKeyName()

Key Input.ParseKeyName ( string keyName)

Parses a string into a Key.

Parameters
keyNameThe key name to parse.
Returns
Returns the parsed key, or null if it could not be parsed.

◆ RemoveActionBind()

void Input.RemoveActionBind ( integer playerID,
string actionName,
integer bindIndex )

Removes a bound input action from a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to unbind.
bindIndexWhich bind index to remove. If not passed, this removes all binds from the given action.

◆ RemoveDefaultActionBind()

void Input.RemoveDefaultActionBind ( integer playerID,
string actionName,
integer bindIndex )

Removes a bound input action default from a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to unbind.
bindIndexWhich bind index to remove. If not passed, this removes all binds from the given action.

◆ ResetActionBindsToDefaults()

void Input.ResetActionBindsToDefaults ( integer playerID)

Sets all input actions for a specific player to its defaults.

Parameters
playerIDIndex of the player.

◆ SetActionBind() [1/2]

void Input.SetActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
enum actionBind,
integer bindIndex )

Binds an input action for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to set.
inputBindTypeThe input bind type.
actionBindThe bind definition.
bindIndexWhich bind index to set.

◆ SetActionBind() [2/2]

void Input.SetActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
map actionBind,
integer bindIndex )

Binds an input action for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to set.
inputBindTypeThe input bind type.
actionBindThe bind definition.
bindIndexWhich bind index to set.

◆ SetDefaultActionBind() [1/2]

void Input.SetDefaultActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
enum actionBind,
integer bindIndex )

Binds a default input action for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to set.
inputBindTypeThe input bind type.
actionBindThe bind definition.
bindIndexWhich bind index to set.

◆ SetDefaultActionBind() [2/2]

void Input.SetDefaultActionBind ( integer playerID,
string actionName,
InputBind inputBindType,
map actionBind,
integer bindIndex )

Binds a default input action for a specific player.

Parameters
playerIDIndex of the player.
actionNameName of the action to set.
inputBindTypeThe input bind type.
actionBindThe bind definition.
bindIndexWhich bind index to set.

◆ SetMouseMode()

void Input.SetMouseMode ( MOUSEMODE mouseMode)

Sets the current mouse mode.

Parameters
mouseModeThe mouse mode to set.

◆ SetPlayerControllerIndex()

void Input.SetPlayerControllerIndex ( integer playerID,
integer controllerID )

Assigns a controller index to a specific player.

Parameters
playerIDIndex of the player.
controllerIDIndex of the controller to assign, or null to unassign.