Murl Engine Lua Addon API  Version 1.0 beta
Murl.Input.IGameControllerDevice

The IGameControllerDevice interface.


Table members

Inherited


Murl.Input.IDevice

Methods


IsConnected()

Check if the controller device is connected. If a controller is disconnected, the connected state changes to false and no more events are generated.
If another controller is connected, the controller device will be reconfigured and the connected state changes to true.

Boolean IsConnected()

Returns
Boolean true if the controlller device is connected.

GetPlayerIndex()

Get the player index.

Integer GetPlayerIndex()

Returns
Integer The zero-based index of the player (typically indicated by lights on the controller), a negative value indicates an unset state (no lights are lit on the controller).

GetDeviceInfo()

Get the device information.

Murl.IGameControllerMapping.DeviceInfo GetDeviceInfo()

Returns
Murl.IGameControllerMapping.DeviceInfo The device information.

IsButtonAvailable(button)

Check if a specified game controller button is available.

Boolean IsButtonAvailable(Murl.IEnums.GameControllerButton button)

Parameters
buttonThe game controller button identifier.
Returns
Boolean true if the button is available.

IsButtonPressed(button)

Check if a specified game controller button is pressed.

Boolean IsButtonPressed(Murl.IEnums.GameControllerButton button)

Parameters
buttonThe game controller button identifier.
Returns
Boolean true if the button is pressed.

WasButtonPressed(button)

Check if a specified game controller button was pressed in the most recent tick.

Boolean WasButtonPressed(Murl.IEnums.GameControllerButton button)

Parameters
buttonThe game controller button identifier.
Returns
Boolean true if the button was pressed in the most recent tick.

WasButtonReleased(button)

Check if a specified game controller button was released in the most recent tick.

Boolean WasButtonReleased(Murl.IEnums.GameControllerButton button)

Parameters
buttonThe game controller button identifier.
Returns
Boolean true if the button was released in the most recent tick.

IsControlAvailable(control)

Check if a specified game controller control is available.

Boolean IsControlAvailable(Murl.IEnums.GameControllerControl control)

Parameters
controlThe game controller control identifier.
Returns
Boolean true if the game controller control is available.

GetShoulder(value, control)

Get the analog shoulder button value. The return value is in range [0.0 not pressed .. 1.0 full pressed].
Supported controls are IEnums::GAME_CONTROLLER_CONTROL_SHOULDER_L1, IEnums::GAME_CONTROLLER_CONTROL_SHOULDER_R1, IEnums::GAME_CONTROLLER_CONTROL_SHOULDER_L2 or IEnums::GAME_CONTROLLER_CONTROL_SHOULDER_R2.

Boolean, Number GetShoulder(Number value, Murl.IEnums.GameControllerControl control)

Parameters
valueThe button return value.
controlThe game controller control identifier.
Returns
Boolean true if the control is available, if false the 'value' return value stay unchanged.
Number value The button return value.

GetGravity(gravity)

Get the gravity axes values. Note that the total acceleration of the controller is equal to gravity plus acceleration.
The values are available if IsControlAvailable(IEnums::GAME_CONTROLLER_CONTROL_ACCELERATION).

Boolean, Murl.Math.Vector GetGravity(Murl.Math.Vector gravity)

Parameters
gravityThe gravity axes return value in meter per seconds^2.
Returns
Boolean true if the control is available, if false the 'gravity' return value stay unchanged.
Murl.Math.Vector gravity The gravity axes return value in meter per seconds^2.

GetAcceleration(acceleration)

Get the acceleration axes values. Note that the total acceleration of the controller is equal to gravity plus acceleration.
The values are available if IsControlAvailable(IEnums::GAME_CONTROLLER_CONTROL_ACCELERATION).

Boolean, Murl.Math.Vector GetAcceleration(Murl.Math.Vector acceleration)

Parameters
accelerationThe acceleration axes return value in meter per seconds^2.
Returns
Boolean true if the control is available, if false the 'acceleration' return value stay unchanged.
Murl.Math.Vector acceleration The acceleration axes return value in meter per seconds^2.

GetStick(xAxis, yAxis, control)

Get the analog stick axis values. The return values are in range [-1.0 bottom/left .. 1.0 top/right].
Supported controls are IEnums::GAME_CONTROLLER_CONTROL_LEFT_STICK or IEnums::GAME_CONTROLLER_CONTROL_RIGHT_STICK.

Boolean, Number, Number GetStick(Number xAxis, Number yAxis, Murl.IEnums.GameControllerControl control)

Parameters
xAxisThe x-axis return value.
yAxisThe y-axis return value.
controlThe game controller control identifier.
Returns
Boolean true if the control is available, if false all return values stay unchanged.
Number xAxis The x-axis return value.
Number yAxis The y-axis return value.

SetTouchOrientationEnabled(isEnabled)

Set the touchpad orientation enabled state. The default value for this state is false, which means that the values of the touchpad are always determined based on the controller’s portrait orientation. If the state is set to true, then the touchpad values are calculated based on its current orientation, either landscape or portrait.
Supported control is IEnums::GAME_CONTROLLER_CONTROL_TOUCH_ORIENTATION.

Boolean SetTouchOrientationEnabled(Boolean isEnabled)

Parameters
isEnabledThe touchpad orientation enabled state.
Returns
Boolean true if the control is available.

GetTouchOrientationEnabled(isEnabled)

Get the touchpad orientation enabled state.

Boolean, Boolean GetTouchOrientationEnabled(Boolean isEnabled)

Parameters
isEnabledThe touchpad orientation enabled state return value.
Returns
Boolean true if the control is available, if false the 'isEnabled' return value stay unchanged.
Boolean isEnabled The touchpad orientation enabled state return value.

SetTouchAbsoluteEnabled(isEnabled)

Set the touchpad absolute enabled state. The default value for this state is false, which means that the location where the user first touches the touchpad is assumed to be the neutral (0/0) value for the touchpad. All subsequent values are calculated relative to this position until the user lifts the finger. The next time the user’s finger touches the touchpad, a new origin is chosen. If this state is set to true, then all values are calculated relative to the physical center of the touchpad.
Supported control is IEnums::GAME_CONTROLLER_CONTROL_TOUCH_ABS_REL.

Boolean SetTouchAbsoluteEnabled(Boolean isEnabled)

Parameters
isEnabledThe touchpad absolute enabled state.
Returns
Boolean true if the control is available.

GetTouchAbsoluteEnabled(isEnabled)

Get the touchpad absolute enabled state.

Boolean, Boolean GetTouchAbsoluteEnabled(Boolean isEnabled)

Parameters
isEnabledThe touchpad absolute enabled state return value.
Returns
Boolean true if the control is available, if false the 'isEnabled' return value stay unchanged.
Boolean isEnabled The touchpad absolute enabled state return value.

SetVibration(intensity, control)

Set a vibration with a specified intensity. Supported controls are IEnums::GAME_CONTROLLER_CONTROL_VIBRATE_LOW or IEnums::GAME_CONTROLLER_CONTROL_VIBRATE_HIGH.

Boolean SetVibration(Number intensity, Murl.IEnums.GameControllerControl control)

Parameters
intensityThe intensity of the vibration in range [0.0 none .. 1.0 full].
controlThe game controller control identifier.
Returns
Boolean true if the control is available.

GetMapping()

Get the game controller mapping interface. Gamecontroller mapping is supported for USB HID game controller devices only, e.g. XBox controller or iOS controllers do not support mapping and return null.

Murl.SharedPointer.IGameControllerMapping GetMapping()

Returns
Murl.SharedPointer.IGameControllerMapping The game controller mapping interface or null if mapping is not supported by the game controller.