Changeset 7284 for code/trunk/src/libraries/core/input/KeyBinderManager.cc
- Timestamp:
- Aug 31, 2010, 3:37:40 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/input/KeyBinderManager.cc
r6417 r7284 31 31 #include "util/Debug.h" 32 32 #include "util/Exception.h" 33 #include "util/ScopedSingletonManager.h" 33 34 #include "core/ConfigValueIncludes.h" 34 #include "core/ConsoleCommand.h"35 35 #include "core/CoreIncludes.h" 36 #include "core/ScopedSingletonManager.h" 36 #include "core/LuaState.h" 37 #include "core/command/ConsoleCommand.h" 37 38 #include "InputManager.h" 38 39 #include "KeyDetector.h" … … 41 42 { 42 43 ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics, false); 44 45 static const std::string __CC_keybind_name = "keybind"; 46 static const std::string __CC_tkeybind_name = "tkeybind"; 47 static const std::string __CC_unbind_name = "unbind"; 48 static const std::string __CC_tunbind_name = "tunbind"; 49 50 SetConsoleCommand(__CC_keybind_name, &KeyBinderManager::keybind).defaultValues("").argumentCompleter(0, autocompletion::command()); 51 SetConsoleCommand(__CC_tkeybind_name, &KeyBinderManager::tkeybind).defaultValues("").argumentCompleter(0, autocompletion::command()); 52 SetConsoleCommand(__CC_unbind_name, &KeyBinderManager::unbind).defaultValues(""); 53 SetConsoleCommand(__CC_tunbind_name, &KeyBinderManager::tunbind).defaultValues(""); 43 54 44 55 KeyBinderManager::KeyBinderManager() … … 51 62 52 63 // keybind console commands 53 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::keybind, this), "keybind" )) 54 .defaultValues(""); 55 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tkeybind, this), "tkeybind")) 56 .defaultValues(""); 57 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::unbind, this), "unbind")) 58 .defaultValues(""); 59 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tunbind, this), "tunbind")) 60 .defaultValues(""); 64 ModifyConsoleCommand(__CC_keybind_name ).setObject(this); 65 ModifyConsoleCommand(__CC_tkeybind_name).setObject(this); 66 ModifyConsoleCommand(__CC_unbind_name ).setObject(this); 67 ModifyConsoleCommand(__CC_tunbind_name ).setObject(this); 61 68 62 69 // Load default key binder … … 69 76 for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it) 70 77 delete it->second; 78 79 // Reset console commands 80 ModifyConsoleCommand(__CC_keybind_name ).setObject(0); 81 ModifyConsoleCommand(__CC_tkeybind_name).setObject(0); 82 ModifyConsoleCommand(__CC_unbind_name ).setObject(0); 83 ModifyConsoleCommand(__CC_tunbind_name ).setObject(0); 71 84 } 72 85 … … 156 169 { 157 170 COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl; 158 KeyDetector::getInstance().setCallback( shared_ptr<Functor>(createFunctor(&KeyBinderManager::keybindKeyPressed, this)));171 KeyDetector::getInstance().setCallback(createFunctor(&KeyBinderManager::keybindKeyPressed, this)); 159 172 InputManager::getInstance().enterState("detector"); 160 173 this->command_ = command; … … 187 200 // else: A key was probably pressed within the same tick, ignore it. 188 201 } 202 203 void KeyBinderManager::registerKeybindCallback(LuaFunctor* function) 204 { 205 this->callbackFunction_ = function; 206 } 189 207 }
Note: See TracChangeset
for help on using the changeset viewer.