![]()  | 
  
    RigsofRods
    2023.09
    
   Soft-body Physics Simulation 
   | 
 
Manages controller configuration, evaluates input events. More...
#include <InputEngine.h>
Public Types | |
| typedef std::vector< event_trigger_t > | TriggerVec | 
| typedef std::map< int, TriggerVec > | EventMap | 
Public Member Functions | |
| InputEngine () | |
| ~InputEngine () | |
Setup  | |
| void | SetKeyboardListener (OIS::KeyListener *obj) | 
| OIS::Keyboard * | GetOisKeyboard () | 
| void | SetMouseListener (OIS::MouseListener *obj) | 
| void | SetJoystickListener (OIS::JoyStickListener *obj) | 
| void | destroy () | 
Input processing  | |
| void | Capture () | 
| void | updateKeyBounces (float dt) | 
| void | processMouseMotionEvent (const OIS::MouseEvent &arg) | 
| void | processMousePressEvent (const OIS::MouseEvent &arg, OIS::MouseButtonID _id) | 
| void | processMouseReleaseEvent (const OIS::MouseEvent &arg, OIS::MouseButtonID _id) | 
| void | ProcessKeyPress (const OIS::KeyEvent &arg) | 
| void | ProcessKeyRelease (const OIS::KeyEvent &arg) | 
| void | ProcessJoystickEvent (const OIS::JoyStickEvent &arg) | 
| void | resetKeysAndMouseButtons () | 
| void | setEventSimulatedValue (events eventID, float value) | 
| void | setEventStatusSupressed (events eventID, bool supress) | 
Event info  | |
| Ogre::String | getKeyForCommand (int eventID) | 
| Ogre::String | getModifierKeyName (OIS::KeyCode key) | 
| Ogre::String | getDeviceName (event_trigger_t const &evt) | 
| Ogre::String | getEventCommand (int eventID) | 
| std::string | getEventCommandTrimmed (int eventID) | 
| Omits 'EXPL' modifier.  More... | |
| Ogre::String | getTriggerCommand (event_trigger_t const &evt) | 
| Ogre::String | getEventConfig (int eventID) | 
| Ogre::String | getEventDefaultConfig (int eventID) | 
| bool | isEventDefined (int eventID) | 
| int | getKeboardKeyForCommand (int eventID) | 
| Returns -1 if not Keyboard.  More... | |
| int | getJoyComponentCount (OIS::ComponentType type, int joystickNumber) | 
| std::string | getJoyVendor (int joystickNumber) | 
| int | getNumJoysticks () | 
| EventMap & | getEvents () | 
Event config files  | |
| bool | loadConfigFile (int deviceID=-1) | 
| Loads config file specific to a device and OS (or default config if deviceID is -1).  More... | |
| bool | saveConfigFile (int deviceID=-1) | 
| Wites events with matching deviceID to loaded file with matching deviceID (or default file if deviceID is -1).  More... | |
| std::string const & | getLoadedConfigFile (int deviceID=-1) | 
Returns filename from loadConfigFile() call.  More... | |
| bool | processLine (const char *line, int deviceID=-1) | 
| bool | updateConfigline (event_trigger_t *t) | 
Event management  | |
| void | addEvent (int eventID, event_trigger_t &t) | 
| Registers new trigger for this event.  More... | |
| void | addEvent (int eventID) | 
| Registers new event without trigger.  More... | |
| void | addEventDefault (int eventID, int deviceID=-1) | 
| Adds a new trigger with builtin value for this event.  More... | |
| void | updateEvent (int eventID, const event_trigger_t &t) | 
| void | eraseEvent (int eventID, const event_trigger_t *t) | 
| void | clearEvents (int eventID) | 
| Clears all bindings for given event.  More... | |
| void | clearEventsByDevice (int deviceID) | 
| Clears all bindings with given deviceID (-1 is no exception).  More... | |
| void | clearAllEvents () | 
| Purges all configured bindings.  More... | |
Event states  | |
| float | getEventValue (int eventID, bool pure=false, InputSourceType valueSource=InputSourceType::IST_ANY) | 
| valueSource: IST_ANY=digital and analog devices, IST_DIGITAL=only digital, IST_ANALOG=only analog  More... | |
| bool | getEventBoolValue (int eventID) | 
| bool | isEventAnalog (int eventID) | 
| bool | getEventBoolValueBounce (int eventID, float time=0.2f) | 
| float | getEventBounceTime (int eventID) | 
| bool | isKeyDownEffective (OIS::KeyCode mod) | 
| Reads RoR internal buffer.  More... | |
| bool | isKeyDownValueBounce (OIS::KeyCode mod, float time=0.2f) | 
Direct input device states  | |
| OIS::JoyStickState * | getCurrentJoyState (int joystickNumber) | 
| OIS::MouseState | getMouseState () | 
| bool | isKeyDown (OIS::KeyCode mod) | 
| Asks OIS directly.  More... | |
| int | getCurrentKeyCombo (Ogre::String *combo) | 
| Returns number of non-modifier keys pressed (or modifier count as negative number).  More... | |
| int | getCurrentJoyButton (int &joystickNumber, int &button) | 
| int | getCurrentPovValue (int &joystickNumber, int &pov, int &povdir) | 
| Ogre::Vector2 | getMouseNormalizedScreenPos () | 
| Returns XY position in range from 0 (top/left) to 1 (bottom/right)  More... | |
Misc  | |
| void | windowResized (Ogre::RenderWindow *rw) | 
| OIS::ForceFeedback * | getForceFeedbackDevice () | 
Static Public Attributes | |
| static const std::string | DEFAULT_MAPFILE = "input.map" | 
| = "input.map";  More... | |
| static const int | DEFAULT_MAPFILE_DEVICEID = -1 | 
| virtual device ID for "input.map" entries  More... | |
| static const int | BUILTIN_MAPPING_DEVICEID = -2 | 
| virtual device ID for builtin defaults  More... | |
Protected Member Functions | |
| bool | loadMapping (Ogre::String fileName, int deviceID) | 
| bool | saveMapping (Ogre::String fileName, int deviceID) | 
| void | completeMissingEvents () | 
| void | initAllKeys () | 
| void | setup () | 
| float | deadZone (float axis, float dz) | 
| float | axisLinearity (float axisValue, float linearity) | 
| float | logval (float val) | 
| std::string | getEventGroup (Ogre::String eventName) | 
| std::string | composeEventConfigString (event_trigger_t const &trig) | 
| std::string | composeEventCommandString (event_trigger_t const &trig) | 
| event_trigger_t | newEvent () | 
Protected Attributes | |
| OIS::InputManager * | mInputManager | 
| OIS::Mouse * | mMouse | 
| OIS::Keyboard * | mKeyboard | 
| OIS::JoyStick * | mJoy [MAX_JOYSTICKS] | 
| int | free_joysticks | 
| Number of detected game controllers.  More... | |
| OIS::ForceFeedback * | mForceFeedback | 
| int | uniqueCounter | 
| std::map< int, bool > | keyState | 
| OIS::JoyStickState | joyState [MAX_JOYSTICKS] | 
| OIS::MouseState | mouseState | 
| std::map< int, std::vector< event_trigger_t > > | events | 
| std::map< int, float > | event_values_simulated | 
| std::map< int, float > | event_times | 
| std::map< int, bool > | event_states_supressed | 
| std::string | m_loaded_configs [MAX_JOYSTICKS] | 
| std::map< std::string, OIS::KeyCode > | allkeys | 
| std::map< std::string, OIS::KeyCode >::iterator | allit | 
| size_t | m_oisworkaround_frames_since_reset = 0u | 
| size_t | m_oisworkaround_lmbdowns_since_reset = 0u | 
Event utils | |
| std::string | getKeyNameForKeyCode (OIS::KeyCode keycode) | 
| static const char * | getEventTypeName (eventtypes type) | 
| Enum to string helper.  More... | |
| static int | resolveEventName (Ogre::String eventName) | 
| static Ogre::String | eventIDToName (int eventID) | 
| static Ogre::String | eventIDToDescription (int eventID) | 
Manages controller configuration, evaluates input events.
Definition at line 460 of file InputEngine.h.
| typedef std::map<int, TriggerVec> RoR::InputEngine::EventMap | 
Definition at line 464 of file InputEngine.h.
| typedef std::vector<event_trigger_t> RoR::InputEngine::TriggerVec | 
Definition at line 463 of file InputEngine.h.
| InputEngine::InputEngine | ( | ) | 
Definition at line 419 of file InputEngine.cpp.
| InputEngine::~InputEngine | ( | ) | 
Definition at line 437 of file InputEngine.cpp.
| void InputEngine::addEvent | ( | int | eventID | ) | 
Registers new event without trigger.
Definition at line 1253 of file InputEngine.cpp.
| void InputEngine::addEvent | ( | int | eventID, | 
| event_trigger_t & | t | ||
| ) | 
Registers new trigger for this event.
Definition at line 1247 of file InputEngine.cpp.
| void InputEngine::addEventDefault | ( | int | eventID, | 
| int | deviceID = -1  | 
        ||
| ) | 
Adds a new trigger with builtin value for this event.
Definition at line 1268 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 813 of file InputEngine.cpp.
| void InputEngine::Capture | ( | ) | 
Definition at line 635 of file InputEngine.cpp.
| void InputEngine::clearAllEvents | ( | ) | 
Purges all configured bindings.
Definition at line 1333 of file InputEngine.cpp.
| void InputEngine::clearEvents | ( | int | eventID | ) | 
Clears all bindings for given event.
Definition at line 1307 of file InputEngine.cpp.
| void InputEngine::clearEventsByDevice | ( | int | deviceID | ) | 
Clears all bindings with given deviceID (-1 is no exception).
Definition at line 1315 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 1884 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 872 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 894 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 798 of file InputEngine.cpp.
| void InputEngine::destroy | ( | ) | 
Definition at line 442 of file InputEngine.cpp.
| void InputEngine::eraseEvent | ( | int | eventID, | 
| const event_trigger_t * | t | ||
| ) | 
Definition at line 1291 of file InputEngine.cpp.
      
  | 
  static | 
Definition at line 2075 of file InputEngine.cpp.
      
  | 
  static | 
Definition at line 2063 of file InputEngine.cpp.
| int InputEngine::getCurrentJoyButton | ( | int & | joystickNumber, | 
| int & | button | ||
| ) | 
Definition at line 1679 of file InputEngine.cpp.
| JoyStickState * InputEngine::getCurrentJoyState | ( | int | joystickNumber | ) | 
Definition at line 1744 of file InputEngine.cpp.
| int InputEngine::getCurrentKeyCombo | ( | Ogre::String * | combo | ) | 
Returns number of non-modifier keys pressed (or modifier count as negative number).
Definition at line 1751 of file InputEngine.cpp.
| int InputEngine::getCurrentPovValue | ( | int & | joystickNumber, | 
| int & | pov, | ||
| int & | povdir | ||
| ) | 
Definition at line 1696 of file InputEngine.cpp.
| String InputEngine::getDeviceName | ( | event_trigger_t const & | evt | ) | 
Definition at line 1202 of file InputEngine.cpp.
| bool InputEngine::getEventBoolValue | ( | int | eventID | ) | 
Definition at line 764 of file InputEngine.cpp.
| bool InputEngine::getEventBoolValueBounce | ( | int | eventID, | 
| float | time = 0.2f  | 
        ||
| ) | 
Definition at line 769 of file InputEngine.cpp.
| float InputEngine::getEventBounceTime | ( | int | eventID | ) | 
Definition at line 782 of file InputEngine.cpp.
| String InputEngine::getEventCommand | ( | int | eventID | ) | 
Definition at line 827 of file InputEngine.cpp.
| std::string InputEngine::getEventCommandTrimmed | ( | int | eventID | ) | 
Omits 'EXPL' modifier.
Definition at line 838 of file InputEngine.cpp.
| String InputEngine::getEventConfig | ( | int | eventID | ) | 
Definition at line 849 of file InputEngine.cpp.
| String InputEngine::getEventDefaultConfig | ( | int | eventID | ) | 
Definition at line 860 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 1802 of file InputEngine.cpp.
      
  | 
  inline | 
Definition at line 512 of file InputEngine.h.
      
  | 
  static | 
Enum to string helper.
Definition at line 1227 of file InputEngine.cpp.
| float InputEngine::getEventValue | ( | int | eventID, | 
| bool | pure = false,  | 
        ||
| InputSourceType | valueSource = InputSourceType::IST_ANY  | 
        ||
| ) | 
valueSource: IST_ANY=digital and analog devices, IST_DIGITAL=only digital, IST_ANALOG=only analog
Definition at line 965 of file InputEngine.cpp.
      
  | 
  inline | 
Definition at line 571 of file InputEngine.h.
| int InputEngine::getJoyComponentCount | ( | OIS::ComponentType | type, | 
| int | joystickNumber | ||
| ) | 
Definition at line 1730 of file InputEngine.cpp.
| std::string InputEngine::getJoyVendor | ( | int | joystickNumber | ) | 
Definition at line 1737 of file InputEngine.cpp.
| int InputEngine::getKeboardKeyForCommand | ( | int | eventID | ) | 
Returns -1 if not Keyboard.
Definition at line 926 of file InputEngine.cpp.
| String InputEngine::getKeyForCommand | ( | int | eventID | ) | 
Definition at line 2235 of file InputEngine.cpp.
| String InputEngine::getKeyNameForKeyCode | ( | OIS::KeyCode | keycode | ) | 
Definition at line 619 of file InputEngine.cpp.
| std::string const & InputEngine::getLoadedConfigFile | ( | int | deviceID = -1 | ) | 
Returns filename from loadConfigFile() call. 
Definition at line 1955 of file InputEngine.cpp.
| Ogre::String InputEngine::getModifierKeyName | ( | OIS::KeyCode | key | ) | 
Definition at line 2248 of file InputEngine.cpp.
| Ogre::Vector2 InputEngine::getMouseNormalizedScreenPos | ( | ) | 
Returns XY position in range from 0 (top/left) to 1 (bottom/right)
Definition at line 1714 of file InputEngine.cpp.
| OIS::MouseState InputEngine::getMouseState | ( | ) | 
Definition at line 606 of file InputEngine.cpp.
      
  | 
  inline | 
Definition at line 511 of file InputEngine.h.
      
  | 
  inline | 
Definition at line 476 of file InputEngine.h.
| String InputEngine::getTriggerCommand | ( | event_trigger_t const & | evt | ) | 
Definition at line 844 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 2087 of file InputEngine.cpp.
| bool InputEngine::isEventAnalog | ( | int | eventID | ) | 
Definition at line 938 of file InputEngine.cpp.
| bool InputEngine::isEventDefined | ( | int | eventID | ) | 
Definition at line 915 of file InputEngine.cpp.
| bool InputEngine::isKeyDown | ( | OIS::KeyCode | mod | ) | 
Asks OIS directly.
Definition at line 1177 of file InputEngine.cpp.
| bool InputEngine::isKeyDownEffective | ( | OIS::KeyCode | mod | ) | 
Reads RoR internal buffer.
Definition at line 1184 of file InputEngine.cpp.
| bool InputEngine::isKeyDownValueBounce | ( | OIS::KeyCode | mod, | 
| float | time = 0.2f  | 
        ||
| ) | 
Definition at line 1189 of file InputEngine.cpp.
| bool InputEngine::loadConfigFile | ( | int | deviceID = -1 | ) | 
Loads config file specific to a device and OS (or default config if deviceID is -1).
Definition at line 1901 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 1964 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 818 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 1723 of file InputEngine.cpp.
| void InputEngine::ProcessJoystickEvent | ( | const OIS::JoyStickEvent & | arg | ) | 
Definition at line 683 of file InputEngine.cpp.
| void InputEngine::ProcessKeyPress | ( | const OIS::KeyEvent & | arg | ) | 
Definition at line 692 of file InputEngine.cpp.
| void InputEngine::ProcessKeyRelease | ( | const OIS::KeyEvent & | arg | ) | 
Definition at line 697 of file InputEngine.cpp.
| bool InputEngine::processLine | ( | const char * | line, | 
| int | deviceID = -1  | 
        ||
| ) | 
Definition at line 1339 of file InputEngine.cpp.
| void InputEngine::processMouseMotionEvent | ( | const OIS::MouseEvent & | arg | ) | 
Definition at line 703 of file InputEngine.cpp.
| void InputEngine::processMousePressEvent | ( | const OIS::MouseEvent & | arg, | 
| OIS::MouseButtonID | _id | ||
| ) | 
Definition at line 711 of file InputEngine.cpp.
| void InputEngine::processMouseReleaseEvent | ( | const OIS::MouseEvent & | arg, | 
| OIS::MouseButtonID | _id | ||
| ) | 
Definition at line 728 of file InputEngine.cpp.
| void InputEngine::resetKeysAndMouseButtons | ( | ) | 
Definition at line 736 of file InputEngine.cpp.
      
  | 
  static | 
Definition at line 2050 of file InputEngine.cpp.
| bool InputEngine::saveConfigFile | ( | int | deviceID = -1 | ) | 
Wites events with matching deviceID to loaded file with matching deviceID (or default file if deviceID is -1).
Definition at line 1945 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 1998 of file InputEngine.cpp.
| void InputEngine::setEventSimulatedValue | ( | RoR::events | eventID, | 
| float | value | ||
| ) | 
Definition at line 754 of file InputEngine.cpp.
| void InputEngine::setEventStatusSupressed | ( | RoR::events | eventID, | 
| bool | supress | ||
| ) | 
Definition at line 759 of file InputEngine.cpp.
| void InputEngine::SetJoystickListener | ( | OIS::JoyStickListener * | obj | ) | 
Definition at line 674 of file InputEngine.cpp.
| void InputEngine::SetKeyboardListener | ( | OIS::KeyListener * | obj | ) | 
Definition at line 662 of file InputEngine.cpp.
| void InputEngine::SetMouseListener | ( | OIS::MouseListener * | obj | ) | 
Definition at line 668 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 473 of file InputEngine.cpp.
| bool InputEngine::updateConfigline | ( | event_trigger_t * | t | ) | 
Definition at line 1816 of file InputEngine.cpp.
| void InputEngine::updateEvent | ( | int | eventID, | 
| const event_trigger_t & | t | ||
| ) | 
Definition at line 1278 of file InputEngine.cpp.
| void InputEngine::updateKeyBounces | ( | float | dt | ) | 
Definition at line 787 of file InputEngine.cpp.
| void InputEngine::windowResized | ( | Ogre::RenderWindow * | rw | ) | 
Definition at line 651 of file InputEngine.cpp.
      
  | 
  protected | 
Definition at line 603 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 602 of file InputEngine.h.
      
  | 
  static | 
virtual device ID for builtin defaults
Definition at line 468 of file InputEngine.h.
      
  | 
  static | 
= "input.map";
Definition at line 466 of file InputEngine.h.
      
  | 
  static | 
virtual device ID for "input.map" entries
Definition at line 467 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 594 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 593 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 592 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 591 of file InputEngine.h.
      
  | 
  protected | 
Number of detected game controllers.
Definition at line 581 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 587 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 586 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 595 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 619 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 620 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 582 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 571 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 580 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 579 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 578 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 588 of file InputEngine.h.
      
  | 
  protected | 
Definition at line 583 of file InputEngine.h.
 1.8.17