Murl::IGameController Interface Referenceabstract

The game controller device interface. More...

#include "murl_i_game_controller.h"

Inherited by Murl::Input::GameControllerDevice.

Public Types

using ButtonArray = Array< IEnums::GameControllerButton >
 Definition of an array holding IEnums::GameControllerButton values.
 
using ControlArray = Array< IEnums::GameControllerControl >
 Definition of an array holding IEnums::GameControllerControl values.
 

Public Member Functions

virtual void SetConnected (Bool isConnected)=0
 Set the connected state. More...
 
virtual void SetPlayerIndex (SInt32 playerIndex)=0
 Set the player index. More...
 
virtual void SetDeviceInfo (const IGameControllerMapping::DeviceInfo &deviceInfo)=0
 Set the device information. More...
 
virtual void SetAvailableControls (const ButtonArray &buttons, const ControlArray &controls)=0
 Set the available controls. More...
 
virtual void PostAxisEvent (IGameControllerMapping::AxisEvent axisEvent, Float value)=0
 Post the current game controller axis value. More...
 
virtual void PostButtonEvent (IEnums::GameControllerButton button, Bool pressed)=0
 Post the current game controller button state. More...
 
virtual void PostGravityEvent (Float gravX, Float gravY, Float gravZ)=0
 Post the current game controller gravity values. More...
 
virtual void PostAccelerationEvent (Float accelX, Float accelY, Float accelZ)=0
 Post the current game controller acceleration values. More...
 
virtual Bool TakeTouchOrientationEnabled (Bool &isEnabled)=0
 Take the touchpad orientation enabled state. More...
 
virtual Bool TakeTouchAbsoluteEnabled (Bool &isEnabled)=0
 Take the touchpad absolute enabled state. More...
 
virtual Bool TakeVibration (Float &intensity, IEnums::GameControllerControl control)=0
 Take the current vibration. More...
 
virtual IGameControllerMappingPtr CreateMapping ()=0
 Create the game controller mapping interface. More...
 

Detailed Description

The game controller device interface.

Used by the platform to post events to the device.

Member Function Documentation

◆ SetConnected()

virtual void Murl::IGameController::SetConnected ( Bool  isConnected)
pure virtual

Set the connected state.

Once a controller is created, it is not allowed to destroy the controller instance when a controller is disconnected. Only the connected state changes. If another controller is connected, the controller instance will be reconfigured.

Parameters
isConnectedThe connected state.

◆ SetPlayerIndex()

virtual void Murl::IGameController::SetPlayerIndex ( SInt32  playerIndex)
pure virtual

Set the player index.

The player number is typically indicated by lights on the controller, a negative index value indicates an unset state (no lights are lit on the controller).

Parameters
playerIndexThe zero-based index of the player.

◆ SetDeviceInfo()

virtual void Murl::IGameController::SetDeviceInfo ( const IGameControllerMapping::DeviceInfo deviceInfo)
pure virtual

Set the device information.

Parameters
deviceInfoThe device information.

◆ SetAvailableControls()

virtual void Murl::IGameController::SetAvailableControls ( const ButtonArray buttons,
const ControlArray controls 
)
pure virtual

Set the available controls.

Automatically sets the d-pad control to available if any d-pad button is set.

Parameters
buttonsAn array of avaliable game controller buttons.
controlsAn array of available game controller controls.

◆ PostAxisEvent()

virtual void Murl::IGameController::PostAxisEvent ( IGameControllerMapping::AxisEvent  axisEvent,
Float  value 
)
pure virtual

Post the current game controller axis value.

Parameters
axisEventThe axis event, see enum IGameControllerMapping::AxisEvents.
valueThe corresponding event value.

◆ PostButtonEvent()

virtual void Murl::IGameController::PostButtonEvent ( IEnums::GameControllerButton  button,
Bool  pressed 
)
pure virtual

Post the current game controller button state.

Parameters
buttonThe button identifier.
pressedtrue if the button is pressed.

◆ PostGravityEvent()

virtual void Murl::IGameController::PostGravityEvent ( Float  gravX,
Float  gravY,
Float  gravZ 
)
pure virtual

Post the current game controller gravity values.

Parameters
gravXThe x-axis gravity in meter per seconds^2.
gravYThe y-axis gravity in meter per seconds^2.
gravZThe z-axis gravity in meter per seconds^2.

◆ PostAccelerationEvent()

virtual void Murl::IGameController::PostAccelerationEvent ( Float  accelX,
Float  accelY,
Float  accelZ 
)
pure virtual

Post the current game controller acceleration values.

Parameters
accelXThe x-axis acceleration in meter per seconds^2.
accelYThe y-axis acceleration in meter per seconds^2.
accelZThe z-axis acceleration in meter per seconds^2.

◆ TakeTouchOrientationEnabled()

virtual Bool Murl::IGameController::TakeTouchOrientationEnabled ( Bool isEnabled)
pure virtual

Take the touchpad orientation enabled state.

Supported controls are IEnums::GAME_CONTROLLER_CONTROL_TOUCH_ORIENTATION.

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

◆ TakeTouchAbsoluteEnabled()

virtual Bool Murl::IGameController::TakeTouchAbsoluteEnabled ( Bool isEnabled)
pure virtual

Take the touchpad absolute enabled state.

Supported controls are IEnums::GAME_CONTROLLER_CONTROL_TOUCH_ABS_REL.

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

◆ TakeVibration()

virtual Bool Murl::IGameController::TakeVibration ( Float intensity,
IEnums::GameControllerControl  control 
)
pure virtual

Take the current vibration.

Supported controls are IEnums::GAME_CONTROLLER_CONTROL_VIBRATE_LOW or IEnums::GAME_CONTROLLER_CONTROL_VIBRATE_HIGH.
Automatically sets the used vibration control to available.

Parameters
intensityThe intensity of the vibration return value in range [0.0 none .. 1.0 full].
controlThe game controller control identifier.
Returns
true if the control is available and the intensity was modified, if false the 'intensity' return value stays unchanged.

◆ CreateMapping()

virtual IGameControllerMappingPtr Murl::IGameController::CreateMapping ( )
pure virtual

Create the game controller mapping interface.

Gamecontroller mapping is supported by USB HID game controller devices only, e.g. XBox controller or iOS controller do not create a mapping.

Returns
The game controller mapping interface.

The documentation for this interface was generated from the following file:
  • murl_i_game_controller.h


Copyright © 2011-2024 Spraylight GmbH.