Changeset 1022 for code/branches/input/src/orxonox/core/InputHandler.cc
- Timestamp:
- Apr 10, 2008, 5:12:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/orxonox/core/InputHandler.cc
r973 r1022 31 31 */ 32 32 33 #include "Debug.h" 34 #include "util/Convert.h" 35 #include "InputEventListener.h" 36 #include "InputEvent.h" 33 37 #include "InputHandler.h" 34 38 … … 54 58 55 59 /** 60 @brief Loads the key bindings from the ini file. 61 Currently, this is just a simple test routine that fills the list with numbers. 62 */ 63 bool InputHandlerGame::loadBindings() 64 { 65 for (int i = 0; i < numberOfKeys_s; i++) 66 { 67 // simply write the key number (i) in the string 68 this->bindingsKeyPressed_[i] = ConvertValueAndReturn<int, std::string>(i); 69 this->bindingsKeyReleased_[i] = ConvertValueAndReturn<int, std::string>(i); 70 } 71 return true; 72 } 73 74 /** 56 75 @brief Event handler for the keyPressed Event. 57 76 @param e Event information … … 59 78 bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e) 60 79 { 80 if (e.key == OIS::KC_ESCAPE) 81 { 82 InputEvent e = {1, true, 0, 0, 0}; 83 InputHandlerGame::callListeners(e); 84 } 85 else 86 { 87 // find the appropriate key binding 88 std::string cmdStr = bindingsKeyPressed_[int(e.key)]; 89 //COUT(3) << cmdStr << " pressed" << std::endl; 90 } 61 91 return true; 62 92 } … … 68 98 bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e) 69 99 { 100 // find the appropriate key binding 101 std::string cmdStr = bindingsKeyReleased_[int(e.key)]; 102 //COUT(3) << cmdStr << " released" << std::endl; 70 103 return true; 71 104 } … … 100 133 } 101 134 135 /** 136 @brief Calls all the objects from classes that derive from InputEventListener. 137 @param evt The input event that occured. 138 */ 139 inline void InputHandlerGame::callListeners(orxonox::InputEvent &evt) 140 { 141 for (Iterator<InputEventListener> it = ObjectList<InputEventListener>::start(); it; ) 142 { 143 if (it->bActive_) 144 (it++)->eventOccured(evt); 145 else 146 it++; 147 } 148 } 149 150 102 151 // ############################### 103 152 // ### InputHandlerGUI ### … … 124 173 bool InputHandlerGUI::keyPressed(const OIS::KeyEvent &e) 125 174 { 175 //CEGUI::System::getSingleton().injectKeyDown( arg.key ); 176 //CEGUI::System::getSingleton().injectChar( arg.text ); 126 177 return true; 127 178 } … … 133 184 bool InputHandlerGUI::keyReleased(const OIS::KeyEvent &e) 134 185 { 186 //CEGUI::System::getSingleton().injectKeyUp( arg.key ); 135 187 return true; 136 188 } … … 142 194 bool InputHandlerGUI::mouseMoved(const OIS::MouseEvent &e) 143 195 { 196 //CEGUI::System::getSingleton().injectMouseMove( arg.state.X.rel, arg.state.Y.rel ); 144 197 return true; 145 198 } … … 152 205 bool InputHandlerGUI::mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) 153 206 { 207 //CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id)); 154 208 return true; 155 209 } … … 162 216 bool InputHandlerGUI::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) 163 217 { 218 //CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id)); 164 219 return true; 165 220 }
Note: See TracChangeset
for help on using the changeset viewer.