Changeset 6214 for code/branches/presentation2/src/libraries
- Timestamp:
- Dec 2, 2009, 8:41:44 PM (15 years ago)
- Location:
- code/branches/presentation2/src/libraries/core
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/libraries/core/CMakeLists.txt
r6194 r6214 91 91 LuaState.h 92 92 input/InputManager.h 93 input/KeyBinder.h 94 input/KeyBinderManager.h 93 95 DEFINE_SYMBOL 94 96 "CORE_SHARED_BUILD" -
code/branches/presentation2/src/libraries/core/GUIManager.cc
r6190 r6214 62 62 namespace orxonox 63 63 { 64 static void key_esc() 65 { GUIManager::getInstance().keyESC(); } 66 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC"); 67 64 68 class CEGUILogger : public CEGUI::DefaultLogger 65 69 { -
code/branches/presentation2/src/libraries/core/Game.cc
r6175 r6214 58 58 { Game::getInstance().stop(); } 59 59 SetConsoleCommandShortcutExternAlias(stop_game, "exit"); 60 static void key_esc()61 { Game::getInstance().keyESC(); }62 SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");63 60 static void printFPS() 64 61 { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; } … … 331 328 } 332 329 333 void Game::keyESC()334 {335 if( this->getState("mainMenu") && this->getState("mainMenu")->getActivity().active==true )336 this->stop();337 else338 GUIManager::getInstance().keyESC();339 }340 341 330 void Game::stop() 342 331 { -
code/branches/presentation2/src/libraries/core/Game.h
r6150 r6214 100 100 void run(); 101 101 void stop(); 102 void keyESC();103 102 104 103 static Game& getInstance(){ return Singleton<Game>::getInstance(); } // tolua_export -
code/branches/presentation2/src/libraries/core/IOConsole.cc
r6196 r6214 260 260 261 261 // Process output written to std::cout 262 std::cout.flush(); 262 263 if (!this->origCout_.str().empty()) 263 264 { -
code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
r6155 r6214 254 254 // Parse bindings and create the ConfigValueContainers if necessary 255 255 for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it) 256 { 256 257 it->second->readConfigValue(this->configFile_); 258 this->allCommands_[it->second->bindingString_] = it->second->groupName_ + " " + it->second->name_; 259 } 257 260 258 261 COUT(3) << "KeyBinder: Loading key bindings done." << std::endl; … … 269 272 it->second->configContainer_->set(binding); 270 273 it->second->configContainer_->getValue(&(it->second->bindingString_), it->second); 274 this->allCommands_[it->second->bindingString_] = it->second->groupName_ + " " + it->second->name_; 271 275 return true; 272 276 } … … 276 280 return false; 277 281 } 282 } 283 284 /** 285 @brief 286 Return the key name for a specific command 287 */ 288 std::string KeyBinder::getBinding(std::string commandName) 289 { 290 COUT(0)<< commandName << endl; 291 if( this->allCommands_.find(commandName) != this->allCommands_.end()) 292 { 293 std::string keyname = this->allCommands_[commandName]; 294 // while(keyname.find(".")!=keyname.npos) 295 // keyname.replace(1, keyname.find("."), " "); 296 COUT(0) << keyname << endl; 297 return keyname; 298 } 299 else 300 return ""; 278 301 } 279 302 -
code/branches/presentation2/src/libraries/core/input/KeyBinder.h
r6155 r6214 43 43 #include "JoyStickQuantityListener.h" 44 44 45 // tolua_begin 45 46 namespace orxonox 46 47 { 48 // tolua_end 47 49 /** 48 50 @brief … … 54 56 KeyBinders. If you need to load other bindings, just create a new one. 55 57 */ 56 class _CoreExport KeyBinder : public InputHandler, public JoyStickQuantityListener 57 { 58 class _CoreExport KeyBinder // tolua_export 59 : public InputHandler, public JoyStickQuantityListener 60 { // tolua_export 58 61 public: 59 62 KeyBinder (const std::string& filename); … … 62 65 void clearBindings(); 63 66 bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false); 67 std::string getBinding(std::string commandName); //tolua_export 64 68 const std::string& getBindingsFilename() 65 69 { return this->filename_; } … … 130 134 //! Pointer list with all half axes 131 135 std::vector<HalfAxis*> allHalfAxes_; 136 //! Maps input commands to all Button names, including half axes 137 std::map<std::string, std::string> allCommands_; 132 138 133 139 /** … … 174 180 // Use some value at about 1000. This can be configured with mouseSensitivity_ anyway. 175 181 static const int mouseClippingSize_ = 1024; 176 }; 182 };// tolua_export 177 183 178 184 … … 219 225 mouseAxes_[i].relVal_ = 0.0f; 220 226 } 221 } 227 }// tolua_export 222 228 223 229 #endif /* _KeyBinder_H__ */ -
code/branches/presentation2/src/libraries/core/input/KeyBinderManager.h
r6190 r6214 37 37 #include "core/OrxonoxClass.h" 38 38 39 namespace orxonox 40 { 39 namespace orxonox //tolua_export 40 { //tolua_export 41 41 /** 42 42 @brief … … 51 51 will not work as expected! 52 52 */ 53 class _CoreExport KeyBinderManager : public Singleton<KeyBinderManager>, public OrxonoxClass 54 { 53 class _CoreExport KeyBinderManager //tolua_export 54 : public Singleton<KeyBinderManager>, public OrxonoxClass 55 { //tolua_export 55 56 friend class Singleton<KeyBinderManager>; 56 57 public: … … 59 60 void setConfigValues(); 60 61 62 static KeyBinderManager& getInstance() { return Singleton<KeyBinderManager>::getInstance(); } //tolua_export 61 63 //! Returns the currently selected KeyBinder 62 KeyBinder* getCurrent() 63 { return this->currentBinder_; } 64 KeyBinder* getCurrent() { return this->currentBinder_; } //tolua_export 64 65 //! Like getCurrent(), but returns it as InputHandler* (so you don't have to include KeyBinder.h) 65 66 InputHandler* getCurrentAsHandler(); … … 115 116 116 117 static KeyBinderManager* singletonPtr_s; 117 }; 118 } 118 }; //tolua_export 119 } //tolua_export 119 120 120 121 #endif /* _KeyBinderManager_H__ */
Note: See TracChangeset
for help on using the changeset viewer.