Changeset 1118 for code/branches/input/src/core/InputHandler.cc
- Timestamp:
- Apr 20, 2008, 4:31:03 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/core/InputHandler.cc
r1112 r1118 74 74 this->bindingsKeyPress_[OIS::KC_NUMPADENTER] = "setInputMode " + getConvertedValue<int, std::string>(IM_KEYBOARD); 75 75 this->bindingsKeyPress_[OIS::KC_ESCAPE] = "exit"; 76 this->bindingsKeyHold_[OIS::KC_U] = "exec disco.txt"; 76 77 return true; 77 78 } … … 83 84 bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e) 84 85 { 86 this->keysDown_.push_back(e.key); 85 87 // find the appropriate key binding 86 88 std::string cmdStr = bindingsKeyPress_[int(e.key)]; … … 99 101 bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e) 100 102 { 103 // remove the key from the keysDown_ list 104 for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++) 105 { 106 if (*it == e.key) 107 { 108 keysDown_.erase(it); 109 break; 110 } 111 } 112 101 113 // find the appropriate key binding 102 114 std::string cmdStr = bindingsKeyRelease_[int(e.key)]; … … 136 148 { 137 149 return true; 150 } 151 152 /** 153 @brief Tick method to do additional calculations. 154 @param dt Delta time. 155 */ 156 void InputHandlerGame::tick(float dt) 157 { 158 // iterate through all the pressed keys 159 for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++) 160 { 161 // find the appropriate key binding 162 std::string cmdStr = bindingsKeyHold_[*it]; 163 if (cmdStr != "") 164 { 165 CommandExecutor::execute(cmdStr); 166 COUT(3) << "Executing command: " << cmdStr << std::endl; 167 } 168 } 138 169 } 139 170 … … 225 256 } 226 257 258 /** 259 @brief Tick method to do additional calculations. 260 @param dt Delta time. 261 */ 262 void InputHandlerGUI::tick(float dt) 263 { 264 265 } 266 227 267 }
Note: See TracChangeset
for help on using the changeset viewer.