19#ifndef HEADER_DEVICE_CONFIG_HPP
20#define HEADER_DEVICE_CONFIG_HPP
22#include "input/binding.hpp"
23#include "input/input.hpp"
24#include "utils/no_copy.hpp"
84 irr::core::stringw toString();
85 bool hasBindingFor(
const int buttonID)
const;
86 bool hasBindingFor(
const int buttonID,
PlayerAction from,
89 const Input::InputType type,
91 Input::AxisDirection direction = Input::AD_NEUTRAL,
92 Input::AxisRange range = Input::AR_HALF);
99 virtual bool isGamePad()
const = 0;
100 virtual bool isKeyboard()
const = 0;
102 virtual void save(std::ofstream& stream);
108 virtual bool isAnalog(Input::InputType type,
int id)
const {
return false;}
118 assert(
false);
return 0;
126 assert(
false);
return 0;
Definition: binding.hpp:37
contains the key bindings information related to one input device
Definition: device_config.hpp:42
int getNumberOfDevices() const
Returns the number of devices using this configuration.
Definition: device_config.hpp:155
bool m_enabled
If set to false, this device will be ignored.
Definition: device_config.hpp:47
bool isPlugged() const
Returns if this config is sed by any devices.
Definition: device_config.hpp:143
void setPlugged()
Increase ref counter.
Definition: device_config.hpp:139
virtual int getNumberOfAxes() const
Should only be called for gamepads, which has its own implementation.
Definition: device_config.hpp:124
bool isEnabled() const
At this time only relevant for gamepads, keyboards are always enabled.
Definition: device_config.hpp:163
void setEnabled(bool new_value)
Sets this config to be enabled or disabled.
Definition: device_config.hpp:167
irr::core::stringw getConfigName() const
Sets the name of this device configuration.
Definition: device_config.hpp:171
virtual void save(std::ofstream &stream)
Saves the configuration to a file.
Definition: device_config.cpp:287
int m_plugged
How many devices connected to the system which uses this config?
Definition: device_config.hpp:50
void setName(const std::string &name)
Sets the internal name of this device.
Definition: device_config.hpp:131
static DeviceConfig * create(const XMLNode *config)
A simple factory that creates either a gamepad or a keyboard configuration.
Definition: device_config.cpp:40
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.
Definition: device_config.cpp:178
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-ful...
Definition: device_config.hpp:108
bool getMenuAction(Input::InputType type, const int id, int *value, PlayerAction *action)
Searches for a game actions associated with the given input event.
Definition: device_config.cpp:212
const Binding & getBinding(int i) const
Returns the binding of a given index.
Definition: device_config.hpp:159
const std::string & getName() const
Returns the internal name for this device configuration.
Definition: device_config.hpp:135
virtual bool load(const XMLNode *config)
Reads a device configuration from input.xml.
Definition: device_config.cpp:310
bool getGameAction(Input::InputType type, const int id, int *value, PlayerAction *action)
Searches for a game actions associated with the given input event.
Definition: device_config.cpp:195
virtual irr::core::stringw getBindingAsString(const PlayerAction action) const
Get a user-readable string describing the bound action.
Definition: device_config.cpp:78
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
Definition: device_config.cpp:225
virtual int getNumberOfButtons() const
Should only be called for gamepads, which has its own implementation.
Definition: device_config.hpp:116
irr::core::stringw getMappingIdString(const PlayerAction action) const
Get an internal unique string describing the bound action.
Definition: device_config.cpp:94
std::string m_name
Internal name of this configuration.
Definition: device_config.hpp:53
virtual bool desensitize() const
Returns true if this device should desensitize its input at values close to 0 (to avoid 'oversteering...
Definition: device_config.hpp:112
void setConfigName(irr::core::stringw config_name)
Returns the name of this device configuration.
Definition: device_config.hpp:175
irr::core::stringw m_config_name
Name of this configuration (given by the user).
Definition: device_config.hpp:56
void unPlugged()
Decrease ref counter.
Definition: device_config.hpp:147
specialisation of Inputdevice for gamepad type devices
Definition: gamepad_device.hpp:33
specialisation of InputDevice for keyboard type devices
Definition: keyboard_device.hpp:34
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
utility class used to parse XML files
Definition: xml_node.hpp:48