Murl::Input::IGameControllerDevice Interface Referenceabstract

The IGameControllerDevice interface. More...

#include "murl_input_i_game_controller_device.h"

Inheritance diagram for Murl::Input::IGameControllerDevice:

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::DeviceInfoGetDeviceInfo () 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 StringGetName () 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()

virtual Bool Murl::Input::IGameControllerDevice::IsConnected ( ) const
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()

virtual SInt32 Murl::Input::IGameControllerDevice::GetPlayerIndex ( ) const
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()

virtual const IGameControllerMapping::DeviceInfo& Murl::Input::IGameControllerDevice::GetDeviceInfo ( ) const
pure virtual

Get the device information.

Returns
The device information.

◆ IsButtonAvailable()

virtual Bool Murl::Input::IGameControllerDevice::IsButtonAvailable ( IEnums::GameControllerButton  button) const
pure virtual

Check if a specified game controller button is available.

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

◆ IsButtonPressed()

virtual Bool Murl::Input::IGameControllerDevice::IsButtonPressed ( IEnums::GameControllerButton  button) const
pure virtual

Check if a specified game controller button is pressed.

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

◆ WasButtonPressed()

virtual Bool Murl::Input::IGameControllerDevice::WasButtonPressed ( IEnums::GameControllerButton  button) const
pure virtual

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

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

◆ WasButtonReleased()

virtual Bool Murl::Input::IGameControllerDevice::WasButtonReleased ( IEnums::GameControllerButton  button) const
pure virtual

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

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

◆ IsControlAvailable()

virtual Bool Murl::Input::IGameControllerDevice::IsControlAvailable ( IEnums::GameControllerControl  control) const
pure virtual

Check if a specified game controller control is available.

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

◆ GetShoulder()

virtual Bool Murl::Input::IGameControllerDevice::GetShoulder ( Float value,
IEnums::GameControllerControl  control 
) const
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
valueThe button return value.
controlThe game controller control identifier.
Returns
true if the control is available, if false the 'value' return value stay unchanged.

◆ GetGravity()

virtual Bool Murl::Input::IGameControllerDevice::GetGravity ( AccelerationVector gravity) const
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
gravityThe 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()

virtual Bool Murl::Input::IGameControllerDevice::GetAcceleration ( AccelerationVector acceleration) const
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
accelerationThe 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()

virtual Bool Murl::Input::IGameControllerDevice::GetStick ( Float xAxis,
Float yAxis,
IEnums::GameControllerControl  control 
) const
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
xAxisThe x-axis return value.
yAxisThe y-axis return value.
controlThe game controller control identifier.
Returns
true if the control is available, if false all return values stay unchanged.

◆ SetTouchOrientationEnabled()

virtual Bool Murl::Input::IGameControllerDevice::SetTouchOrientationEnabled ( Bool  isEnabled)
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
isEnabledThe touchpad orientation enabled state.
Returns
true if the control is available.

◆ GetTouchOrientationEnabled()

virtual Bool Murl::Input::IGameControllerDevice::GetTouchOrientationEnabled ( Bool isEnabled) const
pure virtual

Get the touchpad orientation enabled state.

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

◆ SetTouchAbsoluteEnabled()

virtual Bool Murl::Input::IGameControllerDevice::SetTouchAbsoluteEnabled ( Bool  isEnabled)
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
isEnabledThe touchpad absolute enabled state.
Returns
true if the control is available.

◆ GetTouchAbsoluteEnabled()

virtual Bool Murl::Input::IGameControllerDevice::GetTouchAbsoluteEnabled ( Bool isEnabled) const
pure virtual

Get the touchpad absolute enabled state.

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

◆ SetVibration()

virtual Bool Murl::Input::IGameControllerDevice::SetVibration ( Float  intensity,
IEnums::GameControllerControl  control 
)
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
intensityThe intensity of the vibration in range [0.0 none .. 1.0 full].
controlThe game controller control identifier.
Returns
true if the control is available.

◆ GetMapping()

virtual IGameControllerMappingPtr Murl::Input::IGameControllerDevice::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


Copyright © 2011-2018 Spraylight GmbH.