The IGameControllerDevice interface. More...
#include "murl_input_i_game_controller_device.h"
Public Member Functions | |
virtual Bool | IsConnected () const =0 |
Check if the controller device is connected. More... | |
virtual SInt32 | GetPlayerIndex () const =0 |
Get the player index. More... | |
virtual const IGameControllerMapping::DeviceInfo & | GetDeviceInfo () const =0 |
Get the device information. More... | |
virtual Bool | IsButtonAvailable (IEnums::GameControllerButton button) const =0 |
Check if a specified game controller button is available. More... | |
virtual Bool | IsButtonPressed (IEnums::GameControllerButton button) const =0 |
Check if a specified game controller button is pressed. More... | |
virtual Bool | WasButtonPressed (IEnums::GameControllerButton button) const =0 |
Check if a specified game controller button was pressed in the most recent tick. More... | |
virtual Bool | WasButtonReleased (IEnums::GameControllerButton button) const =0 |
Check if a specified game controller button was released in the most recent tick. More... | |
virtual Bool | IsControlAvailable (IEnums::GameControllerControl control) const =0 |
Check if a specified game controller control is available. More... | |
virtual Bool | GetShoulder (Float &value, IEnums::GameControllerControl control) const =0 |
Get the analog shoulder button value. More... | |
virtual Bool | GetGravity (AccelerationVector &gravity) const =0 |
Get the gravity axes values. More... | |
virtual Bool | GetAcceleration (AccelerationVector &acceleration) const =0 |
Get the acceleration axes values. More... | |
virtual Bool | GetStick (Float &xAxis, Float &yAxis, IEnums::GameControllerControl control) const =0 |
Get the analog stick axis values. More... | |
virtual Bool | SetTouchOrientationEnabled (Bool isEnabled)=0 |
Set the touchpad orientation enabled state. More... | |
virtual Bool | GetTouchOrientationEnabled (Bool &isEnabled) const =0 |
Get the touchpad orientation enabled state. More... | |
virtual Bool | SetTouchAbsoluteEnabled (Bool isEnabled)=0 |
Set the touchpad absolute enabled state. More... | |
virtual Bool | GetTouchAbsoluteEnabled (Bool &isEnabled) const =0 |
Get the touchpad absolute enabled state. More... | |
virtual Bool | SetVibration (Float intensity, IEnums::GameControllerControl control)=0 |
Set a vibration with a specified intensity. More... | |
virtual IGameControllerMappingPtr | GetMapping ()=0 |
Get the game controller mapping interface. More... | |
Public Member Functions inherited from Murl::Input::IDevice | |
virtual const String & | GetName () const =0 |
Get the device name. More... | |
virtual UInt32 | GetId () const =0 |
Get the unique device identifier. More... | |
virtual Bool | HasUpdate () const =0 |
Check if the device has received new data since the last Update(). More... | |
virtual void | LogicUpdate ()=0 |
Is executed in the logic thread context each logic tick. | |
virtual void | ConfigChanged (const IAppConfiguration *appConfig)=0 |
Notification of changed configuration. More... | |
Detailed Description
The IGameControllerDevice interface.
Member Function Documentation
◆ IsConnected()
|
pure virtual |
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.
- Returns
- true if the controlller device is connected.
◆ GetPlayerIndex()
|
pure virtual |
Get the player index.
- Returns
- 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()
|
pure virtual |
Get the device information.
- Returns
- The device information.
◆ IsButtonAvailable()
|
pure virtual |
Check if a specified game controller button is available.
- Parameters
-
button The game controller button identifier.
- Returns
- true if the button is available.
◆ IsButtonPressed()
|
pure virtual |
Check if a specified game controller button is pressed.
- Parameters
-
button The game controller button identifier.
- Returns
- true if the button is pressed.
◆ WasButtonPressed()
|
pure virtual |
Check if a specified game controller button was pressed in the most recent tick.
- Parameters
-
button The game controller button identifier.
- Returns
- true if the button was pressed in the most recent tick.
◆ WasButtonReleased()
|
pure virtual |
Check if a specified game controller button was released in the most recent tick.
- Parameters
-
button The game controller button identifier.
- Returns
- true if the button was released in the most recent tick.
◆ IsControlAvailable()
|
pure virtual |
Check if a specified game controller control is available.
- Parameters
-
control The game controller control identifier.
- Returns
- true if the game controller control is available.
◆ GetShoulder()
|
pure virtual |
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.
- Parameters
-
value The button return value. control The game controller control identifier.
- Returns
- true if the control is available, if false the 'value' return value stay unchanged.
◆ GetGravity()
|
pure virtual |
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).
- Parameters
-
gravity The gravity axes return value in meter per seconds^2.
- Returns
- true if the control is available, if false the 'gravity' return value stay unchanged.
◆ GetAcceleration()
|
pure virtual |
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).
- Parameters
-
acceleration The acceleration axes return value in meter per seconds^2.
- Returns
- true if the control is available, if false the 'acceleration' return value stay unchanged.
◆ GetStick()
|
pure virtual |
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.
- Parameters
-
xAxis The x-axis return value. yAxis The y-axis return value. control The game controller control identifier.
- Returns
- true if the control is available, if false all return values stay unchanged.
◆ SetTouchOrientationEnabled()
|
pure virtual |
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.
- Parameters
-
isEnabled The touchpad orientation enabled state.
- Returns
- true if the control is available.
◆ GetTouchOrientationEnabled()
|
pure virtual |
Get the touchpad orientation enabled state.
- Parameters
-
isEnabled The touchpad orientation enabled state return value.
- Returns
- true if the control is available, if false the 'isEnabled' return value stay unchanged.
◆ SetTouchAbsoluteEnabled()
|
pure virtual |
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.
- Parameters
-
isEnabled The touchpad absolute enabled state.
- Returns
- true if the control is available.
◆ GetTouchAbsoluteEnabled()
|
pure virtual |
Get the touchpad absolute enabled state.
- Parameters
-
isEnabled The touchpad absolute enabled state return value.
- Returns
- true if the control is available, if false the 'isEnabled' return value stay unchanged.
◆ SetVibration()
|
pure virtual |
Set a vibration with a specified intensity.
Supported controls are IEnums::GAME_CONTROLLER_CONTROL_VIBRATE_LOW or IEnums::GAME_CONTROLLER_CONTROL_VIBRATE_HIGH.
- Parameters
-
intensity The intensity of the vibration in range [0.0 none .. 1.0 full]. control The game controller control identifier.
- Returns
- true if the control is available.
◆ GetMapping()
|
pure virtual |
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.
- Returns
- The game controller mapping interface or null if mapping is not supported by the game controller.
The documentation for this interface was generated from the following file:
- murl_input_i_game_controller_device.h