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

Functions for getting information about controllers, as well as functions to control rumble. More...

Public Member Functions

integer GetCount ()
 Gets the amount of connected controllers in the device.
boolean IsConnected (integer controllerIndex)
 Gets whether the controller at the index is connected.
boolean IsXbox (integer controllerIndex)
 Gets whether the controller at the index is an Xbox controller.
boolean IsPlayStation (integer controllerIndex)
 Gets whether the controller at the index is a PlayStation controller.
boolean IsJoyCon (integer controllerIndex)
 Gets whether the controller at the index is a Nintendo Switch Joy-Con L or R.
boolean HasShareButton (integer controllerIndex)
 Gets whether the controller at the index has a Share or Capture button.
boolean HasMicrophoneButton (integer controllerIndex)
 Gets whether the controller at the index has a Microphone button.
boolean HasPaddles (integer controllerIndex)
 Gets whether the controller at the index has paddles.
boolean IsButtonHeld (integer controllerIndex, Button button)
 Checks if a button is held.
boolean IsButtonPressed (integer controllerIndex, Button button)
 Checks if a button is pressed.
boolean GetButton (integer controllerIndex, Button button)
 Gets the button value from the controller at the index.
decimal GetAxis (integer controllerIndex, Axis axis)
 Gets the axis value from the controller at the index.
Controller GetType (integer controllerIndex)
 Gets the type of the controller at the index.
string GetName (integer controllerIndex)
 Gets the name of the controller at the index.
void SetPlayerIndex (integer controllerIndex, integer playerIndex)
 Sets the player index of the controller at the index.
boolean HasRumble (integer controllerIndex)
 Checks if the controller at the index supports rumble.
boolean IsRumbleActive (integer controllerIndex)
 Checks if rumble is active for the controller at the index.
void Rumble (integer controllerIndex, number strength, integer duration)
 Rumbles a controller.
void StopRumble (integer controllerIndex)
 Stops controller haptics.
boolean IsRumblePaused (integer controllerIndex)
 Checks if rumble is paused for the controller at the index.
void SetRumblePaused (integer controllerIndex)
 Pauses or unpauses rumble for the controller at the index.
void SetLargeMotorFrequency (integer controllerIndex, number frequency)
 Sets the frequency of a controller's large motor.
void SetSmallMotorFrequency (integer controllerIndex, number frequency)
 Sets the frequency of a controller's small motor.

Detailed Description

Functions for getting information about controllers, as well as functions to control rumble.

Member Function Documentation

◆ GetAxis()

decimal Controller.GetAxis ( integer controllerIndex,
Axis axis )

Gets the axis value from the controller at the index.

Parameters
controllerIndexIndex of the controller to check.
axisWhich axis to check.
Returns
Returns the axis value from the controller at the index.

◆ GetButton()

boolean Controller.GetButton ( integer controllerIndex,
Button button )

Gets the button value from the controller at the index.

Parameters
controllerIndexIndex of the controller to check.
buttonWhich button to check.
Returns
Returns the button value from the controller at the index.
Deprecated
Use Controller.IsButtonHeld instead.

◆ GetCount()

integer Controller.GetCount ( )

Gets the amount of connected controllers in the device.

Returns
Returns the amount of connected controllers in the device.

◆ GetName()

string Controller.GetName ( integer controllerIndex)

Gets the name of the controller at the index.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns the name of the controller at the index.

◆ GetType()

Controller Controller.GetType ( integer controllerIndex)

Gets the type of the controller at the index.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns the type of the controller at the index.

◆ HasMicrophoneButton()

boolean Controller.HasMicrophoneButton ( integer controllerIndex)

Gets whether the controller at the index has a Microphone button.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index has a Microphone button.

◆ HasPaddles()

boolean Controller.HasPaddles ( integer controllerIndex)

Gets whether the controller at the index has paddles.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index has paddles.

◆ HasRumble()

boolean Controller.HasRumble ( integer controllerIndex)

Checks if the controller at the index supports rumble.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller supports rumble.

◆ HasShareButton()

boolean Controller.HasShareButton ( integer controllerIndex)

Gets whether the controller at the index has a Share or Capture button.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index has a Share or Capture button.

◆ IsButtonHeld()

boolean Controller.IsButtonHeld ( integer controllerIndex,
Button button )

Checks if a button is held.

Parameters
controllerIndexIndex of the controller to check.
buttonWhich button to check.
Returns
Returns a boolean value.

◆ IsButtonPressed()

boolean Controller.IsButtonPressed ( integer controllerIndex,
Button button )

Checks if a button is pressed.

Parameters
controllerIndexIndex of the controller to check.
buttonWhich button to check.
Returns
Returns a boolean value.

◆ IsConnected()

boolean Controller.IsConnected ( integer controllerIndex)

Gets whether the controller at the index is connected.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index is connected.

◆ IsJoyCon()

boolean Controller.IsJoyCon ( integer controllerIndex)

Gets whether the controller at the index is a Nintendo Switch Joy-Con L or R.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index is a Nintendo Switch Joy-Con L or R.

◆ IsPlayStation()

boolean Controller.IsPlayStation ( integer controllerIndex)

Gets whether the controller at the index is a PlayStation controller.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index is a PlayStation controller.

◆ IsRumbleActive()

boolean Controller.IsRumbleActive ( integer controllerIndex)

Checks if rumble is active for the controller at the index.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether rumble is active for the controller.

◆ IsRumblePaused()

boolean Controller.IsRumblePaused ( integer controllerIndex)

Checks if rumble is paused for the controller at the index.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether rumble is paused for the controller.

◆ IsXbox()

boolean Controller.IsXbox ( integer controllerIndex)

Gets whether the controller at the index is an Xbox controller.

Parameters
controllerIndexIndex of the controller to check.
Returns
Returns whether the controller at the index is an Xbox controller.

◆ Rumble()

void Controller.Rumble ( integer controllerIndex,
number strength,
integer duration )

Rumbles a controller.

Parameters
controllerIndexIndex of the controller to rumble.
strengthRumble strength. (0.0 - 1.0)
durationDuration in milliseconds. Use 0 for infinite duration.

◆ SetLargeMotorFrequency()

void Controller.SetLargeMotorFrequency ( integer controllerIndex,
number frequency )

Sets the frequency of a controller's large motor.

Parameters
controllerIndexIndex of the controller.
frequencyFrequency of the large motor.
Deprecated
Use Controller.Rumble instead.

◆ SetPlayerIndex()

void Controller.SetPlayerIndex ( integer controllerIndex,
integer playerIndex )

Sets the player index of the controller at the index.

Parameters
controllerIndexIndex of the controller.
playerIndexThe player index. Use -1 to disable the controller's LEDs.

◆ SetRumblePaused()

void Controller.SetRumblePaused ( integer controllerIndex)

Pauses or unpauses rumble for the controller at the index.

Parameters
controllerIndexIndex of the controller.

◆ SetSmallMotorFrequency()

void Controller.SetSmallMotorFrequency ( integer controllerIndex,
number frequency )

Sets the frequency of a controller's small motor.

Parameters
controllerIndexIndex of the controller.
frequencyFrequency of the small motor.
Deprecated
Use Controller.Rumble instead.

◆ StopRumble()

void Controller.StopRumble ( integer controllerIndex)

Stops controller haptics.

Parameters
controllerIndexIndex of the controller to stop.