Public Member Functions | List of all members
KeyboardDevice Class Reference

specialisation of InputDevice for keyboard type devices More...

#include <keyboard_device.hpp>

Inheritance diagram for KeyboardDevice:
Inheritance graph

Public Member Functions

 KeyboardDevice (KeyboardConfig *configuration)
virtual bool processAndMapInput (Input::InputType type, const int id, InputManager::InputDriverMode mode, PlayerAction *action, int *value=NULL) OVERRIDE
 Invoked when this device it used. More...
- Public Member Functions inherited from InputDevice
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...
void setConnected (bool val)
bool isConnected () const

Additional Inherited Members

- Protected Attributes inherited from InputDevice
bool m_connected
 For SDL controller it's set false when it's unplugged. More...
DeviceType m_type
 Device type (keyboard, gamepad). More...
 Which player is using this device. More...
 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

specialisation of InputDevice for keyboard type devices

Member Function Documentation

◆ processAndMapInput()

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

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.

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).
Whether the pressed key/button is bound with an action

Implements InputDevice.

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