Changeset 5869
- Timestamp:
- Oct 4, 2009, 12:26:05 AM (15 years ago)
- Location:
- code/branches/core5/src/libraries/core
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/Core.cc
r5867 r5869 70 70 #include "TclThreadManager.h" 71 71 #include "input/InputManager.h" 72 #include "input/KeyBinderManager.h"73 72 74 73 namespace orxonox … … 290 289 inputManager_.reset(new InputManager()); 291 290 292 // Manages KeyBinders and makes them available293 keyBinderManager_.reset(new KeyBinderManager());294 295 291 // load the CEGUI interface 296 292 guiManager_.reset(new GUIManager(graphicsManager_->getRenderWindow(), … … 309 305 this->graphicsScope_.reset(); 310 306 this->guiManager_.reset(); 311 this->keyBinderManager_.reset();312 307 this->inputManager_.reset(); 313 308 this->graphicsManager_.reset(); -
code/branches/core5/src/libraries/core/Core.h
r5863 r5869 100 100 scoped_ptr<GraphicsManager> graphicsManager_; //!< Interface to OGRE 101 101 scoped_ptr<InputManager> inputManager_; //!< Interface to OIS 102 scoped_ptr<KeyBinderManager> keyBinderManager_; //!< Manages all KeyBinders103 102 scoped_ptr<GUIManager> guiManager_; //!< Interface to GUI 104 103 scoped_ptr<Scope<ScopeID::Root> > rootScope_; -
code/branches/core5/src/libraries/core/input/InputManager.cc
r5863 r5869 53 53 54 54 #include "InputBuffer.h" 55 #include "KeyDetector.h"56 55 #include "JoyStick.h" 57 56 #include "JoyStickQuantityListener.h" … … 90 89 , bExclusiveMouse_(false) 91 90 , emptyState_(0) 92 , keyDetector_(0)93 91 , calibratorCallbackHandler_(0) 94 92 { … … 105 103 emptyState_->setHandler(&InputHandler::EMPTY); 106 104 activeStates_[emptyState_->getPriority()] = emptyState_; 107 108 // KeyDetector to evaluate a pressed key's name109 InputState* detector = createInputState("detector", false, false, InputStatePriority::Detector);110 // Create a callback to avoid buttonHeld events after the key has been detected111 detector->setLeaveFunctor(createFunctor(&InputManager::clearBuffers, this));112 keyDetector_ = new KeyDetector();113 detector->setHandler(keyDetector_);114 105 115 106 // Joy stick calibration helper callback … … 274 265 275 266 // Destroy calibrator helper handler and state 276 keyDetector_->destroy();277 267 this->destroyState("calibrator"); 278 268 // Destroy KeyDetector and state 279 269 calibratorCallbackHandler_->destroy(); 280 this->destroyState("detector");281 270 // destroy the empty InputState 282 271 this->destroyStateInternal(this->emptyState_); -
code/branches/core5/src/libraries/core/input/InputManager.h
r5863 r5869 195 195 // some internally handled states and handlers 196 196 InputState* emptyState_; //!< Lowest priority states (makes handling easier) 197 KeyDetector* keyDetector_; //!< KeyDetector instance198 197 //! InputBuffer that reacts to the Enter key when calibrating the joy sticks 199 198 InputBuffer* calibratorCallbackHandler_; -
code/branches/core5/src/libraries/core/input/KeyBinderManager.cc
r5863 r5869 34 34 #include "core/ConsoleCommand.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/ScopedSingletonManager.h" 36 37 #include "InputManager.h" 37 38 #include "KeyDetector.h" … … 40 41 { 41 42 KeyBinderManager* KeyBinderManager::singletonPtr_s = 0; 43 ManageScopedSingleton(KeyBinderManager, ScopeID::Graphics); 42 44 43 45 KeyBinderManager::KeyBinderManager() -
code/branches/core5/src/libraries/core/input/KeyDetector.cc
r5864 r5869 31 31 #include "core/ConsoleCommand.h" 32 32 #include "core/CoreIncludes.h" 33 #include "core/ScopedSingletonManager.h" 33 34 #include "Button.h" 35 #include "InputManager.h" 36 #include "InputState.h" 34 37 35 38 namespace orxonox … … 37 40 std::string KeyDetector::callbackCommand_s = "KeyDetectorKeyPressed"; 38 41 KeyDetector* KeyDetector::singletonPtr_s = 0; 42 ManageScopedSingleton(KeyDetector, ScopeID::Graphics); 39 43 40 44 KeyDetector::KeyDetector() … … 45 49 CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyDetector::callback, this), callbackCommand_s)); 46 50 this->assignCommands(); 51 52 inputState_ = InputManager::getInstance().createInputState("detector", false, false, InputStatePriority::Detector); 53 // Create a callback to avoid buttonHeld events after the key has been detected 54 inputState_->setLeaveFunctor(createFunctor(&InputManager::clearBuffers, &InputManager::getInstance())); 55 inputState_->setHandler(this); 56 } 57 58 KeyDetector::~KeyDetector() 59 { 60 inputState_->setHandler(NULL); 61 InputManager::getInstance().destroyState("detector"); 47 62 } 48 63 -
code/branches/core5/src/libraries/core/input/KeyDetector.h
r5864 r5869 43 43 public: 44 44 KeyDetector(); 45 ~KeyDetector() { }45 ~KeyDetector(); 46 46 47 47 void setCallback(Functor* function) { this->callbackFunction_ = function; } … … 55 55 56 56 Functor* callbackFunction_; 57 InputState* inputState_; 57 58 static std::string callbackCommand_s; 58 59 static KeyDetector* singletonPtr_s;
Note: See TracChangeset
for help on using the changeset viewer.