![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The IGameControllerDevice interface.
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()
Get the player index.
Integer GetPlayerIndex()
Get the device information.
Murl.IGameControllerMapping.DeviceInfo GetDeviceInfo()
Check if a specified game controller button is available.
Boolean IsButtonAvailable(Murl.IEnums.GameControllerButton button)
button | The game controller button identifier. |
Check if a specified game controller button is pressed.
Boolean IsButtonPressed(Murl.IEnums.GameControllerButton button)
button | The game controller button identifier. |
Check if a specified game controller button was pressed in the most recent tick.
Boolean WasButtonPressed(Murl.IEnums.GameControllerButton button)
button | The game controller button identifier. |
Check if a specified game controller button was released in the most recent tick.
Boolean WasButtonReleased(Murl.IEnums.GameControllerButton button)
button | The game controller button identifier. |
Check if a specified game controller control is available.
Boolean IsControlAvailable(Murl.IEnums.GameControllerControl control)
control | The game controller control identifier. |
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)
value | The button return value. |
control | The game controller control identifier. |
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)
gravity | The gravity axes return value in meter per seconds^2. |
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)
acceleration | The acceleration axes return value in meter per seconds^2. |
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)
xAxis | The x-axis return value. |
yAxis | The y-axis return value. |
control | The game controller control identifier. |
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)
isEnabled | The touchpad orientation enabled state. |
Get the touchpad orientation enabled state.
Boolean, Boolean GetTouchOrientationEnabled(Boolean isEnabled)
isEnabled | The touchpad orientation enabled state return value. |
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)
isEnabled | The touchpad absolute enabled state. |
Get the touchpad absolute enabled state.
Boolean, Boolean GetTouchAbsoluteEnabled(Boolean isEnabled)
isEnabled | The touchpad absolute enabled state return value. |
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)
intensity | The intensity of the vibration in range [0.0 none .. 1.0 full]. |
control | The game controller control identifier. |
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()