SuperTuxKart
Public Member Functions | Protected Attributes | List of all members
InputDevice Class Referenceabstract

base class for input devices More...

#include <input_device.hpp>

Inheritance diagram for InputDevice:
Inheritance graph
[legend]

Public Member Functions

virtual bool processAndMapInput (Input::InputType type, const int id, InputManager::InputDriverMode mode, PlayerAction *action, int *value=NULL)=0
 Invoked when this device it used. More...
 
void setPlayer (StateManager::ActivePlayer *owner)
 Sets which players uses this device; or pass NULL to say no player uses it. More...
 
void setConfiguration (DeviceConfig *config)
 Sets the configuration to be used by this input device. More...
 
DeviceConfiggetConfiguration ()
 Returns the configuration for this device. More...
 
DeviceType getType () const
 Returns the type of this device. More...
 
StateManager::ActivePlayergetPlayer ()
 Returns the player using this device. More...
 
const std::string & getName () const
 Returns the name of this device. More...
 

Protected Attributes

DeviceType m_type
 Device type (keyboard, gamepad). More...
 
StateManager::ActivePlayerm_player
 Which player is using this device. More...
 
DeviceConfigm_configuration
 The configuration for this device. More...
 
std::string m_name
 If device has a name; unused for keyboards since AFAIK we can't tell keyboards apart. More...
 

Detailed Description

base class for input devices

Member Function Documentation

◆ getConfiguration()

DeviceConfig* InputDevice::getConfiguration ( )
inline

Returns the configuration for this device.

◆ getName()

const std::string& InputDevice::getName ( ) const
inline

Returns the name of this device.

◆ getPlayer()

StateManager::ActivePlayer* InputDevice::getPlayer ( )
inline

Returns the player using this device.

◆ getType()

DeviceType InputDevice::getType ( ) const
inline

Returns the type of this device.

◆ processAndMapInput()

virtual bool InputDevice::processAndMapInput ( Input::InputType  type,
const int  id,
InputManager::InputDriverMode  mode,
PlayerAction action,
int *  value = NULL 
)
pure 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

Implemented in MultitouchDevice, GamePadDevice, and KeyboardDevice.

◆ setConfiguration()

void InputDevice::setConfiguration ( DeviceConfig config)
inline

Sets the configuration to be used by this input device.

◆ setPlayer()

void InputDevice::setPlayer ( StateManager::ActivePlayer owner)
inline

Sets which players uses this device; or pass NULL to say no player uses it.

Member Data Documentation

◆ m_configuration

DeviceConfig* InputDevice::m_configuration
protected

The configuration for this device.

◆ m_name

std::string InputDevice::m_name
protected

If device has a name; unused for keyboards since AFAIK we can't tell keyboards apart.

◆ m_player

StateManager::ActivePlayer* InputDevice::m_player
protected

Which player is using this device.

◆ m_type

DeviceType InputDevice::m_type
protected

Device type (keyboard, gamepad).


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