SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GamePadDevice Class Reference

specialisation of Inputdevice for gamepad type devices More...

#include <gamepad_device.hpp>

Inheritance diagram for GamePadDevice:
Inheritance graph
[legend]

Public Member Functions

 GamePadDevice (const int irrIndex, const std::string &name, const int axis_number, const int button_count, GamepadConfig *configuration)
 Constructor for GamePadDevice from a connected gamepad for which no configuration existed (defaults will be used)
 
virtual ~GamePadDevice ()
 Destructor for GamePadDevice.
 
bool isButtonPressed (const int i)
 
void setButtonPressed (const int i, bool isButtonPressed)
 
virtual bool processAndMapInput (Input::InputType type, const int id, InputManager::InputDriverMode mode, PlayerAction *action, int *value=NULL) OVERRIDE
 Invoked when this device it used.
 
int getNumberOfButtons () const
 Returns the number of buttons of this gamepad.
 
bool moved (int value) const
 Returns if the specified value is larger than the deadzone.
 
int getIrrIndex () const
 Returns the irrlicht index of this gamepad.
 
void setIrrIndex (int i)
 
bool useForceFeedback () const
 
int getAutoCenterStrength () const
 
- Public Member Functions inherited from InputDevice
virtual bool processAndMapInput (Input::InputType type, const int id, InputManager::InputDriverMode mode, PlayerAction *action, int *value=NULL)=0
 Invoked when this device it used.
 
void setPlayer (StateManager::ActivePlayer *owner)
 Sets which players uses this device; or pass NULL to say no player uses it.
 
void setConfiguration (DeviceConfig *config)
 Sets the configuration to be used by this input device.
 
DeviceConfiggetConfiguration ()
 Returns the configuration for this device.
 
DeviceType getType () const
 Returns the type of this device.
 
StateManager::ActivePlayergetPlayer ()
 Returns the player using this device.
 
const std::string & getName () const
 Returns the name of this device.
 
void setConnected (bool val)
 
bool isConnected () const
 

Private Member Functions

void resetAxisDirection (const int axis, Input::AxisDirection direction)
 

Private Attributes

std::vector< bool > m_button_pressed
 
std::vector< Input::AxisDirection > m_prev_axis_directions
 
int m_irr_index
 Irrlicht index of this gamepad.
 

Additional Inherited Members

- Protected Attributes inherited from InputDevice
bool m_connected
 For SDL controller it's set false when it's unplugged.
 
DeviceType m_type
 Device type (keyboard, gamepad).
 
StateManager::ActivePlayerm_player
 Which player is using this device.
 
DeviceConfigm_configuration
 The configuration for this device.
 
std::string m_name
 If device has a name; unused for keyboards since AFAIK we can't tell keyboards apart.
 

Detailed Description

specialisation of Inputdevice for gamepad type devices

Constructor & Destructor Documentation

◆ GamePadDevice()

GamePadDevice::GamePadDevice ( const int  irr_index,
const std::string &  name,
const int  axis_count,
const int  button_count,
GamepadConfig configuration 
)

Constructor for GamePadDevice from a connected gamepad for which no configuration existed (defaults will be used)

Parameters
irrIndexIndex of stick as given by irrLicht.

Member Function Documentation

◆ processAndMapInput()

bool GamePadDevice::processAndMapInput ( Input::InputType  type,
const int  id,
InputManager::InputDriverMode  mode,
PlayerAction action,
int *  value = NULL 
)
virtual

Invoked when this device it used.

Verifies if the key/button that was pressed is associated with a binding. If yes, sets action and returns true; otherwise returns false. It can also modify the value used.

Parameters
typeType of input (e.g. IT_STICKMOTION, ...).
idID of the key that was pressed or of the axis that was triggered (depending on the value of the 'type' parameter).
modeUsed to determine whether to map menu actions or game actions
[out]actionThe action associated to this input (only check this value if method returned true)
[in,out]valueThe value associated with this type (typically how far a gamepad axis is moved).
Returns
Whether the pressed key/button is bound with an action

Implements InputDevice.


The documentation for this class was generated from the following files: