SuperTuxKart
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GamepadConfig Class Reference

specialisation of DeviceConfig for gamepad type devices More...

#include <gamepad_config.hpp>

Inheritance diagram for GamepadConfig:
Inheritance graph
[legend]

Public Member Functions

 GamepadConfig (const std::string &name, const int axis_count=0, const int button_ount=0)
 
core::stringw toString ()
 Converts the configuration to a string.
 
virtual void save (std::ofstream &stream) OVERRIDE
 Saves the configuration to a file. More...
 
void setDefaultBinds ()
 
virtual core::stringw getBindingAsString (const PlayerAction action) const OVERRIDE
 Get a user-readable string describing the bound action.
 
virtual bool load (const XMLNode *config) OVERRIDE
 Loads this configuration from the given XML node. More...
 
virtual bool isAnalog (Input::InputType type, int id) const OVERRIDE
 Returns if this device uses analog axes. More...
 
virtual bool desensitize () const OVERRIDE
 Returns true if this device should desensitize its input at values close to 0 (to avoid 'oversteering'). More...
 
virtual int getNumberOfButtons () const OVERRIDE
 Returns the number of buttons in this configuration. More...
 
void setNumberOfButtons (int count)
 Sets the number of buttons this device has. More...
 
virtual int getNumberOfAxes () const OVERRIDE
 Returns the number of axis of this configufation. More...
 
void setNumberOfAxis (int count)
 Sets the number of axis this device has. More...
 
int getDeadzone () const
 Return deadzone of this configuration. More...
 
virtual bool isGamePad () const OVERRIDE
 
virtual bool isKeyboard () const OVERRIDE
 
void initSDLController (const std::string &mapping, int buttons, int axes, int hats)
 
void initSDLMapping ()
 
bool useForceFeedback () const
 
void setForceFeedback (bool val)
 
int getAutoCenterStrength () const
 
void setAutoCenter (bool val)
 
- Public Member Functions inherited from DeviceConfig
irr::core::stringw toString ()
 
bool hasBindingFor (const int buttonID) const
 
bool hasBindingFor (const int buttonID, PlayerAction from, PlayerAction to) const
 
void setBinding (const PlayerAction action, const Input::InputType type, const int id, Input::AxisDirection direction=Input::AD_NEUTRAL, Input::AxisRange range=Input::AR_HALF, wchar_t character=0)
 Sets the bindings for an action. More...
 
bool getMenuAction (Input::InputType type, const int id, int *value, PlayerAction *action)
 Searches for a game actions associated with the given input event. More...
 
irr::core::stringw getMappingIdString (const PlayerAction action) const
 Get an internal unique string describing the bound action. More...
 
void setName (const std::string &name)
 Sets the internal name of this device. More...
 
const std::string & getName () const
 Returns the internal name for this device configuration. More...
 
void setPlugged ()
 Increase ref counter. More...
 
bool isPlugged () const
 Returns if this config is sed by any devices. More...
 
void unPlugged ()
 Decrease ref counter. More...
 
int getNumberOfDevices () const
 Returns the number of devices using this configuration. More...
 
const BindinggetBinding (int i) const
 Returns the binding of a given index. More...
 
bool isEnabled () const
 At this time only relevant for gamepads, keyboards are always enabled.
 
void setEnabled (bool new_value)
 Sets this config to be enabled or disabled. More...
 
irr::core::stringw getConfigName () const
 Sets the name of this device configuration.
 
void setConfigName (irr::core::stringw config_name)
 Returns the name of this device configuration.
 

Private Member Functions

bool getMappingTuple (const std::string &rhs, std::tuple< int, Input::AxisDirection > &t)
 
void setBindingFromTuple (const PlayerAction action, std::tuple< int, Input::AxisDirection > &t)
 

Private Attributes

int m_axis_count
 Number of axis this device has. More...
 
int m_hat_count
 Number of hat this device has. More...
 
int m_button_count
 Number of buttons this device has. More...
 
int m_deadzone
 Deadzone of this gamepad. More...
 
bool m_desensitize
 If set to true, map any analog axis from x in [0,1] to x^x –> at values close to 0 the joystick will react less sensitive. More...
 
bool m_use_force_feedback
 
int m_auto_center
 
std::map< std::tuple< int, Input::AxisDirection >, int > m_sdl_mapping
 
std::set< int > m_digital_axes
 

Additional Inherited Members

- Static Public Member Functions inherited from DeviceConfig
static DeviceConfigcreate (const XMLNode *config)
 A simple factory that creates either a gamepad or a keyboard configuration. More...
 
- Protected Member Functions inherited from DeviceConfig
bool doGetAction (Input::InputType type, const int id, int *value, const PlayerAction firstActionToCheck, const PlayerAction lastActionToCheck, PlayerAction *action)
 internal helper method for DeviceConfig::getGameAction and DeviceConfig::getMenuAction
 
bool getGameAction (Input::InputType type, const int id, int *value, PlayerAction *action)
 Searches for a game actions associated with the given input event. More...
 
- Protected Attributes inherited from DeviceConfig
Binding m_bindings [PA_COUNT]
 

Detailed Description

specialisation of DeviceConfig for gamepad type devices

Member Function Documentation

◆ desensitize()

virtual bool GamepadConfig::desensitize ( ) const
inlinevirtual

Returns true if this device should desensitize its input at values close to 0 (to avoid 'oversteering').

Reimplemented from DeviceConfig.

◆ getDeadzone()

int GamepadConfig::getDeadzone ( ) const
inline

Return deadzone of this configuration.

◆ getNumberOfAxes()

virtual int GamepadConfig::getNumberOfAxes ( ) const
inlinevirtual

Returns the number of axis of this configufation.

Reimplemented from DeviceConfig.

◆ getNumberOfButtons()

virtual int GamepadConfig::getNumberOfButtons ( ) const
inlinevirtual

Returns the number of buttons in this configuration.

Reimplemented from DeviceConfig.

◆ isAnalog()

bool GamepadConfig::isAnalog ( Input::InputType  type,
int  id 
) const
virtual

Returns if this device uses analog axes.

Reimplemented from DeviceConfig.

◆ load()

bool GamepadConfig::load ( const XMLNode config)
virtual

Loads this configuration from the given XML node.

Parameters
configThe XML tree.
Returns
False in case of an error.

Reimplemented from DeviceConfig.

◆ save()

void GamepadConfig::save ( std::ofstream &  stream)
virtual

Saves the configuration to a file.

It writes the name for a gamepad config, saves the device specific parameters, and calls DeviceConfig::save() to save the rest.

Parameters
streamThe stream to save to.

Reimplemented from DeviceConfig.

◆ setNumberOfAxis()

void GamepadConfig::setNumberOfAxis ( int  count)
inline

Sets the number of axis this device has.

◆ setNumberOfButtons()

void GamepadConfig::setNumberOfButtons ( int  count)
inline

Sets the number of buttons this device has.

Member Data Documentation

◆ m_axis_count

int GamepadConfig::m_axis_count
private

Number of axis this device has.

◆ m_button_count

int GamepadConfig::m_button_count
private

Number of buttons this device has.

◆ m_deadzone

int GamepadConfig::m_deadzone
private

Deadzone of this gamepad.

◆ m_desensitize

bool GamepadConfig::m_desensitize
private

If set to true, map any analog axis from x in [0,1] to x^x –> at values close to 0 the joystick will react less sensitive.

◆ m_hat_count

int GamepadConfig::m_hat_count
private

Number of hat this device has.


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