Changeset 1112 for code/branches/input/src/core
- Timestamp:
- Apr 19, 2008, 10:31:52 PM (17 years ago)
- Location:
- code/branches/input/src/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/core/InputHandler.cc
r1066 r1112 38 38 #include "InputEvent.h" 39 39 #include "InputManager.h" 40 #include "core/CommandExecutor.h" 40 41 41 42 namespace orxonox … … 68 69 { 69 70 // simply write the key number (i) in the string 70 this->bindingsKeyPressed_[i] = getConvertedValue<int, std::string>(i); 71 this->bindingsKeyReleased_[i] = getConvertedValue<int, std::string>(i); 72 } 71 this->bindingsKeyPress_[i] = ""; 72 this->bindingsKeyRelease_[i] = ""; 73 } 74 this->bindingsKeyPress_[OIS::KC_NUMPADENTER] = "setInputMode " + getConvertedValue<int, std::string>(IM_KEYBOARD); 75 this->bindingsKeyPress_[OIS::KC_ESCAPE] = "exit"; 73 76 return true; 74 77 } … … 80 83 bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e) 81 84 { 82 if (e.key == OIS::KC_ESCAPE) 83 { 84 InputEvent e = {1, true, 0, 0, 0}; 85 InputHandlerGame::callListeners(e); 86 } 87 else if (e.key == OIS::KC_NUMPADENTER) 88 { 89 InputManager::getSingleton().setInputMode(IM_KEYBOARD); 90 } 91 else 92 { 93 // find the appropriate key binding 94 std::string cmdStr = bindingsKeyPressed_[int(e.key)]; 95 //COUT(3) << cmdStr << " pressed" << std::endl; 85 // find the appropriate key binding 86 std::string cmdStr = bindingsKeyPress_[int(e.key)]; 87 if (cmdStr != "") 88 { 89 CommandExecutor::execute(cmdStr); 90 COUT(3) << "Executing command: " << cmdStr << std::endl; 96 91 } 97 92 return true; … … 105 100 { 106 101 // find the appropriate key binding 107 std::string cmdStr = bindingsKeyReleased_[int(e.key)]; 108 //COUT(3) << cmdStr << " released" << std::endl; 102 std::string cmdStr = bindingsKeyRelease_[int(e.key)]; 103 if (cmdStr != "") 104 { 105 CommandExecutor::execute(cmdStr); 106 COUT(3) << "Executing command: " << cmdStr << std::endl; 107 } 109 108 return true; 110 109 } -
code/branches/input/src/core/InputHandler.h
r1062 r1112 44 44 namespace orxonox 45 45 { 46 namespace KeybindSetting 47 { 48 enum KeybindSetting 49 { 50 none, 51 onPress, 52 onRelease, 53 continuous, 54 }; 55 } 56 57 class _CoreExport BaseInputHandler 58 : public OIS::KeyListener, public OIS::MouseListener 59 { 60 }; 61 46 62 /** 47 63 @brief Captures mouse and keyboard input while in the actual game mode. 48 64 Manages the key bindings. 49 65 */ 50 class _CoreExport InputHandlerGame 51 : public OIS::KeyListener, public OIS::MouseListener 66 class _CoreExport InputHandlerGame : public BaseInputHandler 52 67 { 53 68 public: … … 72 87 static const int numberOfKeys_s = 256; 73 88 //! Array of input events for every pressed key 74 std::string bindingsKeyPress ed_[numberOfKeys_s];89 std::string bindingsKeyPress_[numberOfKeys_s]; 75 90 //! Array of input events for every released key 76 std::string bindingsKeyReleased_[numberOfKeys_s]; 91 std::string bindingsKeyRelease_[numberOfKeys_s]; 92 //! Array of input events for every holding key 93 std::string bindingsKeyHold_[numberOfKeys_s]; 77 94 78 95 /** denotes the maximum number of different buttons there are in OIS. … … 91 108 GUI. 92 109 */ 93 class _CoreExport InputHandlerGUI 94 : public OIS::KeyListener, public OIS::MouseListener 110 class _CoreExport InputHandlerGUI : public BaseInputHandler 95 111 { 96 112 public: -
code/branches/input/src/core/InputManager.cc
r1089 r1112 93 93 paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); 94 94 95 #if defined OIS_LINUX_PLATFORM96 paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));97 #endif95 //#if defined OIS_LINUX_PLATFORM 96 // paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true"))); 97 //#endif 98 98 99 99 try
Note: See TracChangeset
for help on using the changeset viewer.