SuperTuxKart
|
contains the key bindings information related to one input device More...
#include <device_config.hpp>
Public Member Functions | |
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) |
Sets the bindings for an action. | |
bool | getMenuAction (Input::InputType type, const int id, int *value, PlayerAction *action) |
Searches for a game actions associated with the given input event. | |
irr::core::stringw | getMappingIdString (const PlayerAction action) const |
Get an internal unique string describing the bound action. | |
virtual irr::core::stringw | getBindingAsString (const PlayerAction action) const |
Get a user-readable string describing the bound action. | |
virtual bool | isGamePad () const =0 |
virtual bool | isKeyboard () const =0 |
virtual void | save (std::ofstream &stream) |
Saves the configuration to a file. | |
virtual bool | load (const XMLNode *config) |
Reads a device configuration from input.xml. | |
virtual bool | isAnalog (Input::InputType type, int id) const |
Returns true if this device has analog axis, so that steering values will not be affected by time-full-steer delays. | |
virtual bool | desensitize () const |
Returns true if this device should desensitize its input at values close to 0 (to avoid 'oversteering'). | |
virtual int | getNumberOfButtons () const |
Should only be called for gamepads, which has its own implementation. | |
virtual int | getNumberOfAxes () const |
Should only be called for gamepads, which has its own implementation. | |
void | setName (const std::string &name) |
Sets the internal name of this device. | |
const std::string & | getName () const |
Returns the internal name for this device configuration. | |
void | setPlugged () |
Increase ref counter. | |
bool | isPlugged () const |
Returns if this config is sed by any devices. | |
void | unPlugged () |
Decrease ref counter. | |
int | getNumberOfDevices () const |
Returns the number of devices using this configuration. | |
const Binding & | getBinding (int i) const |
Returns the binding of a given index. | |
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. | |
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. | |
Static Public Member Functions | |
static DeviceConfig * | create (const XMLNode *config) |
A simple factory that creates either a gamepad or a keyboard configuration. | |
Protected Member Functions | |
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. | |
Protected Attributes | |
Binding | m_bindings [PA_COUNT] |
Private Attributes | |
bool | m_enabled |
If set to false, this device will be ignored. | |
int | m_plugged |
How many devices connected to the system which uses this config? | |
std::string | m_name |
Internal name of this configuration. | |
irr::core::stringw | m_config_name |
Name of this configuration (given by the user). | |
Friends | |
class | GamePadDevice |
Those two classes need to be able to call getGameAction. | |
class | KeyboardDevice |
contains the key bindings information related to one input device
|
static |
A simple factory that creates either a gamepad or a keyboard configuration.
type | "gamepad" or "keyboard". |
config | The XML node with additional configuration parameters. |
|
inlinevirtual |
Returns true if this device should desensitize its input at values close to 0 (to avoid 'oversteering').
Reimplemented in GamepadConfig.
|
virtual |
Get a user-readable string describing the bound action.
Reimplemented in GamepadConfig.
|
protected |
Searches for a game actions associated with the given input event.
[out] | action | the result, only set if method returned true. |
irr::core::stringw DeviceConfig::getMappingIdString | ( | const PlayerAction | action | ) | const |
Get an internal unique string describing the bound action.
action | The action for which to get the string. |
bool DeviceConfig::getMenuAction | ( | Input::InputType | type, |
const int | id, | ||
int * | value, | ||
PlayerAction * | action | ||
) |
Searches for a game actions associated with the given input event.
[out] | action | The result, only set if method returned true. |
|
inlinevirtual |
Should only be called for gamepads, which has its own implementation.
of this function.
Reimplemented in GamepadConfig.
|
inlinevirtual |
Should only be called for gamepads, which has its own implementation.
of this function.
Reimplemented in GamepadConfig.
|
inlinevirtual |
Returns true if this device has analog axis, so that steering values will not be affected by time-full-steer delays.
Reimplemented in GamepadConfig.
|
virtual |
Reads a device configuration from input.xml.
config | The XML Node of the configuration. |
Reimplemented in GamepadConfig.
|
virtual |
Saves the configuration to a file.
The calling node must have written the beginning of the xml node, so that this function can immediately start writing attributes.
stream | The stream to save to. |
Reimplemented in KeyboardConfig, and GamepadConfig.
void DeviceConfig::setBinding | ( | const PlayerAction | action, |
const Input::InputType | type, | ||
const int | id, | ||
Input::AxisDirection | direction = Input::AD_NEUTRAL , |
||
Input::AxisRange | range = Input::AR_HALF |
||
) |
Sets the bindings for an action.
action | The action to be bound. |
type | Input type (stick button, stick motion, ...). |
id | An id for this binding. |
direction | In which direction the stick is moved. |
|
private |
If set to false, this device will be ignored.
Currently for gamepads only.