|
Orxonox
0.0.5 Codename: Arcturus
|
Maps mouse, keyboard and joy stick input to command strings and executes them. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/input/KeyBinder.h>
Classes | |
| struct | JoyStickAxisVector |
| Helper class to use something like std:vector<HalfAxis[48]> More... | |
| struct | JoyStickButtonVector |
| Helper class to use something like std:vector<Button[64]> More... | |
Public Member Functions | |
| KeyBinder (const std::string &filename) | |
| Constructor that does as little as necessary. More... | |
| virtual | ~KeyBinder () |
| Destructor. More... | |
| void | changeMode (ConsoleCommand *command, KeybindMode::Value mode) |
| Changes the keybind mode of a given console command. More... | |
| void | clearBindings () |
| Overwrites all bindings with "". More... | |
| std::string | getBinding (const std::string &commandName) |
| Return the first key name for a specific command. More... | |
| std::string | getBinding (const std::string &commandName, unsigned int index) |
| Return the key name for a specific command at a given index. More... | |
| std::string | getBindingReadable (const std::string &commandName) |
| Return the first key name for a specific command in a human readable form. More... | |
| const std::string & | getBindingsFilename () |
| unsigned int | getNumberOfBindings (const std::string &commandName) |
| Get the number of different key bindings of a specific command. More... | |
| void | resetJoyStickAxes () |
| void | resetMouseAxes () |
| Sets the position of the mouse back to 0/0. More... | |
| bool | setBinding (const std::string &binding, const std::string &name, bool bTemporary=false) |
| void | setConfigValues () |
| Loader for the key bindings, managed by config values. More... | |
Public Member Functions inherited from orxonox::InputHandler | |
| virtual | ~InputHandler ()=default |
| template<class T > | |
| void | buttonEvent (unsigned int device, T button, ButtonEvent::TPress) |
| template<class T > | |
| void | buttonEvent (unsigned int device, T button, ButtonEvent::TRelease) |
| template<class T > | |
| void | buttonEvent (unsigned int device, T button, ButtonEvent::THold) |
| virtual void | keyboardUpdated (float dt) |
Public Member Functions inherited from orxonox::Listable | |
| Listable () | |
| Constructor: Allocates space in the element list. More... | |
| Listable (Context *context) | |
| Constructor: Allocates space in the element list and assigns the context. More... | |
| virtual | ~Listable () |
| Destructor: Removes the object from the object-lists. More... | |
| Context * | getContext () const |
| void | setContext (Context *context) |
| Changes the context. More... | |
| void | unregisterObject () |
| Removes this object from the object-lists. More... | |
Public Member Functions inherited from orxonox::Identifiable | |
| Identifiable () | |
| Constructor: Sets the default values. More... | |
| virtual | ~Identifiable () |
| ORX_FORCEINLINE void * | getDerivedPointer (unsigned int classID) |
| Returns a valid pointer of any derived type that is registered in the class hierarchy. More... | |
| template<class T > | |
| ORX_FORCEINLINE T * | getDerivedPointer (unsigned int classID) |
| Version of getDerivedPointer with template. More... | |
| template<class T > | |
| ORX_FORCEINLINE const T * | getDerivedPointer (unsigned int classID) const |
| Const version of getDerivedPointer with template. More... | |
| Identifier * | getIdentifier () const |
| Returns the Identifier of the object. More... | |
| bool | isA (const Identifier *identifier) |
| Returns true if the object's class is of the given type or a derivative. More... | |
| template<class B > | |
| bool | isA (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is of the given type or a derivative. More... | |
| bool | isA (const Identifiable *object) |
| Returns true if the object's class is of the given type or a derivative. More... | |
| bool | isChildOf (const Identifier *identifier) |
| Returns true if the object's class is a child of the given type. More... | |
| template<class B > | |
| bool | isChildOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a child of the given type. More... | |
| bool | isChildOf (const Identifiable *object) |
| Returns true if the object's class is a child of the given type. More... | |
| bool | isDirectChildOf (const Identifier *identifier) |
| Returns true if the object's class is a direct child of the given type. More... | |
| template<class B > | |
| bool | isDirectChildOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a direct child of the given type. More... | |
| bool | isDirectChildOf (const Identifiable *object) |
| Returns true if the object's class is a direct child of the given type. More... | |
| bool | isDirectParentOf (const Identifier *identifier) |
| Returns true if the object's class is a direct parent of the given type. More... | |
| template<class B > | |
| bool | isDirectParentOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a direct parent of the given type. More... | |
| bool | isDirectParentOf (const Identifiable *object) |
| Returns true if the object's class is a direct child of the given type. More... | |
| bool | isExactlyA (const Identifier *identifier) |
| Returns true if the object's class is exactly of the given type. More... | |
| template<class B > | |
| bool | isExactlyA (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is exactly of the given type. More... | |
| bool | isExactlyA (const Identifiable *object) |
| Returns true if the object's class is exactly of the given type. More... | |
| bool | isParentOf (const Identifier *identifier) |
| Returns true if the object's class is a parent of the given type. More... | |
| template<class B > | |
| bool | isParentOf (const SubclassIdentifier< B > *identifier) |
| Returns true if the object's class is a parent of the given type. More... | |
| bool | isParentOf (const Identifiable *object) |
| Returns true if the object's class is a parent of the given type. More... | |
Protected Member Functions | |
| virtual void | allDevicesUpdated (float dt) override |
| virtual void | axisMoved (unsigned int device, unsigned int axis, float value) override |
| virtual void | buttonHeld (const KeyEvent &evt) override |
| virtual void | buttonHeld (MouseButtonCode::ByEnum button) override |
| virtual void | buttonHeld (unsigned int device, JoyStickButtonCode::ByEnum button) override |
| virtual void | buttonPressed (const KeyEvent &evt) override |
| virtual void | buttonPressed (MouseButtonCode::ByEnum button) override |
| virtual void | buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button) override |
| virtual void | buttonReleased (const KeyEvent &evt) override |
| virtual void | buttonReleased (MouseButtonCode::ByEnum button) override |
| virtual void | buttonReleased (unsigned int device, JoyStickButtonCode::ByEnum button) override |
| void | buttonThresholdChanged () |
| void | compilePointerLists () |
| void | initialiseJoyStickBindings () |
| virtual void | JoyStickQuantityChanged (const std::vector< JoyStick * > &joyStickList) override |
| Called whenever joy sticks get added/removed. More... | |
| virtual void | joyStickUpdated (unsigned int joyStick, float dt) override |
| void | loadBindings () |
| Loads the key and button bindings. More... | |
| virtual void | mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) override |
| Event handler for the mouseMoved Event. More... | |
| virtual void | mouseScrolled (int abs, int rel) override |
| Event handler for the mouseScrolled Event. More... | |
| virtual void | mouseUpdated (float dt) override |
| void | tickHalfAxis (HalfAxis &halfAxis) |
Protected Member Functions inherited from orxonox::JoyStickQuantityListener | |
| JoyStickQuantityListener () | |
| virtual | ~JoyStickQuantityListener ()=default |
| const std::vector< JoyStick * > & | getJoyStickList () const |
| Returns a list with all JoySticks currently loaded. More... | |
Protected Attributes | |
| std::map< std::string, Button * > | allButtons_ |
| Pointer map with all Buttons, including half axes. More... | |
| std::map< std::string, std::vector< std::string > > | allCommands_ |
| Maps input commands to all Button names, including half axes. More... | |
| std::vector< HalfAxis * > | allHalfAxes_ |
| Pointer list with all half axes. More... | |
| ConfigFile * | configFile_ |
| Config file used. nullptr in case of KeyDetector. Also indicates whether we've already loaded. More... | |
| float | deriveTime_ |
| ConfigFile * | fallbackConfigFile_ |
| Config file from the data directory that only serves as fallback. More... | |
| const std::string | filename_ |
| Name of the file used in this KeyBinder (constant!) More... | |
| std::vector< std::shared_ptr< JoyStickAxisVector > > | joyStickAxes_ |
| Actual key bindings for joy stick axes (and sliders) More... | |
| std::vector< std::shared_ptr< JoyStickButtonVector > > | joyStickButtons_ |
| Actual key bindings for joy stick buttons. More... | |
| std::vector< JoyStick * > | joySticks_ |
| Currently active joy sticks. More... | |
| Button | keys_ [KeyCode::numberOfKeys] |
| Actual key bindings for keys on the keyboard. More... | |
| HalfAxis | mouseAxes_ [MouseAxisCode::numberOfAxes *2] |
| Actual key bindings for mouse axes. More... | |
| Button | mouseButtons_ [numberOfMouseButtons_] |
| Actual key bindings for mouse buttons including the wheel(s) More... | |
| float | mousePosition_ [2] |
| Keeps track of the absolute mouse value. More... | |
| int | mouseRelative_ [2] |
| Used to derive mouse input if requested. More... | |
| std::vector< BufferedParamCommand * > | paramCommandBuffer_ |
| Commands that have additional parameters (axes) are executed at the end of update() so that all values can be buffered for single execution. More... | |
Static Protected Attributes | |
| static const unsigned int | numberOfMouseButtons_ = MouseButtonCode::numberOfButtons + 4 |
| Number of mouse buttons in KeyBinder (+4) More... | |
Private Member Functions | |
| void | addButtonToCommand (const std::string &command, Button *button) |
Private Attributes | |
| float | analogThreshold_ |
| Threshold for analog triggers until which the state is 0. More... | |
| bool | bDeriveMouseInput_ |
| Derive mouse input for absolute values? More... | |
| bool | bFilterAnalogNoise_ |
| Whether to filter small value analog input. More... | |
| float | buttonThreshold_ |
| Threshold for analog triggers until which the button is not pressed. More... | |
| float | derivePeriod_ |
| Accuracy of the mouse input deriver. The higher the more precise, but laggier. More... | |
| float | mouseSensitivity_ |
| mouse sensitivity More... | |
| float | mouseSensitivityDerived_ |
| mouse sensitivity if mouse input is derived More... | |
| int | mouseWheelStepSize_ |
| Equals one step of the mouse wheel. More... | |
| float | totalMouseSensitivity_ |
| Multiplication of mouse sensitivity and clipping size. More... | |
Static Private Attributes | |
| static const int | mouseClippingSize_ = 1024 |
Additional Inherited Members | |
Static Public Attributes inherited from orxonox::InputHandler | |
| static InputHandler | EMPTY |
| Use this input handler if you want to occupy a device in an input state. More... | |
Maps mouse, keyboard and joy stick input to command strings and executes them.
The bindings are stored in ini-files (like the one for configValues) in the config Path.
| orxonox::KeyBinder::KeyBinder | ( | const std::string & | filename | ) |
Constructor that does as little as necessary.
|
virtual |
Destructor.
|
private |
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
|
overrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
Reimplemented from orxonox::InputHandler.
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
Reimplemented from orxonox::InputHandler.
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
Reimplemented from orxonox::InputHandler.
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
|
inlineoverrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
|
protected |
| void orxonox::KeyBinder::changeMode | ( | ConsoleCommand * | command, |
| KeybindMode::Value | mode | ||
| ) |
Changes the keybind mode of a given console command.
| void orxonox::KeyBinder::clearBindings | ( | ) |
Overwrites all bindings with "".
|
protected |
| std::string orxonox::KeyBinder::getBinding | ( | const std::string & | commandName | ) |
Return the first key name for a specific command.
| std::string orxonox::KeyBinder::getBinding | ( | const std::string & | commandName, |
| unsigned int | index | ||
| ) |
Return the key name for a specific command at a given index.
| commandName | The command name the key name is returned for. |
| index | The index at which the key name is returned for. |
| std::string orxonox::KeyBinder::getBindingReadable | ( | const std::string & | commandName | ) |
Return the first key name for a specific command in a human readable form.
|
inline |
| unsigned int orxonox::KeyBinder::getNumberOfBindings | ( | const std::string & | commandName | ) |
Get the number of different key bindings of a specific command.
| commandName | The command. |
|
protected |
|
overrideprotectedvirtual |
Called whenever joy sticks get added/removed.
Implements orxonox::JoyStickQuantityListener.
Reimplemented in orxonox::KeyDetector.
|
overrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
|
protected |
Loads the key and button bindings.
|
overrideprotectedvirtual |
Event handler for the mouseMoved Event.
| abs_ | The absolute position of the mouse |
| rel_ | The relative movement of the mouse |
| clippingSize | Mouse screen area in pixels (usually 1024x1024) |
Reimplemented from orxonox::InputHandler.
|
overrideprotectedvirtual |
Event handler for the mouseScrolled Event.
| abs | The absolute position of the scroll wheel |
| rel | The relative movement of the scroll wheel |
Reimplemented from orxonox::InputHandler.
|
overrideprotectedvirtual |
Reimplemented from orxonox::InputHandler.
| void orxonox::KeyBinder::resetJoyStickAxes | ( | ) |
| void orxonox::KeyBinder::resetMouseAxes | ( | ) |
Sets the position of the mouse back to 0/0.
| bool orxonox::KeyBinder::setBinding | ( | const std::string & | binding, |
| const std::string & | name, | ||
| bool | bTemporary = false |
||
| ) |
Loader for the key bindings, managed by config values.
|
protected |
Pointer map with all Buttons, including half axes.
|
protected |
Maps input commands to all Button names, including half axes.
|
protected |
Pointer list with all half axes.
|
private |
Threshold for analog triggers until which the state is 0.
|
private |
Derive mouse input for absolute values?
|
private |
Whether to filter small value analog input.
|
private |
Threshold for analog triggers until which the button is not pressed.
|
protected |
Config file used. nullptr in case of KeyDetector. Also indicates whether we've already loaded.
|
private |
Accuracy of the mouse input deriver. The higher the more precise, but laggier.
|
protected |
|
protected |
Config file from the data directory that only serves as fallback.
|
protected |
Name of the file used in this KeyBinder (constant!)
|
protected |
Actual key bindings for joy stick axes (and sliders)
|
protected |
Actual key bindings for joy stick buttons.
|
protected |
Currently active joy sticks.
|
protected |
Actual key bindings for keys on the keyboard.
|
protected |
Actual key bindings for mouse axes.
|
protected |
Actual key bindings for mouse buttons including the wheel(s)
|
staticprivate |
|
protected |
Keeps track of the absolute mouse value.
|
protected |
Used to derive mouse input if requested.
|
private |
mouse sensitivity
|
private |
mouse sensitivity if mouse input is derived
|
private |
Equals one step of the mouse wheel.
|
staticprotected |
Number of mouse buttons in KeyBinder (+4)
|
protected |
Commands that have additional parameters (axes) are executed at the end of update() so that all values can be buffered for single execution.
|
private |
Multiplication of mouse sensitivity and clipping size.
1.8.11