SuperTuxKart
Public Member Functions | Private Types | 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 () 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 isGamePadAndroid () const OVERRIDE
 
virtual bool isKeyboard () const OVERRIDE
 
- 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 name of this device. More...
 
const std::string & getName () const
 Returns the 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...
 
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...
 

Private Types

enum  { GP_UNIDENTIFIED, GP_XBOX360, GP_XBOX_ORIGINAL }
 A type to keep track if the gamepad has been identified (which is used to display better button names and better defaults). More...
 

Private Member Functions

void detectType ()
 Try to identify a gamepad type (e.g. More...
 

Private Attributes

int m_axis_count
 Number of axis 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_is_analog
 If this device has analog axis, steering etc. 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...
 
enum GamepadConfig:: { ... }  m_type
 A type to keep track if the gamepad has been identified (which is used to display better button names and better defaults). More...
 

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 Enumeration Documentation

◆ anonymous enum

anonymous enum
private

A type to keep track if the gamepad has been identified (which is used to display better button names and better defaults).

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.

◆ detectType()

void GamepadConfig::detectType ( )
private

Try to identify a gamepad type (e.g.

'xbox'), so that better defaults and button names can be set. Atm the gamepad name is used.

◆ 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()

virtual bool GamepadConfig::isAnalog ( ) const
inlinevirtual

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_is_analog

bool GamepadConfig::m_is_analog
private

If this device has analog axis, steering etc.

must be set immediately from the input values, not having a delayed time (time-full-steer).

◆ m_type

enum { ... } GamepadConfig::m_type

A type to keep track if the gamepad has been identified (which is used to display better button names and better defaults).


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