Changeset 1653 for code/branches/gui/src/core
- Timestamp:
- Aug 5, 2008, 9:50:26 PM (16 years ago)
- Location:
- code/branches/gui/src/core/input
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/input/ExtendedInputState.cc
r1642 r1653 37 37 #include <assert.h> 38 38 #include "core/Debug.h" 39 #include "core/CoreIncludes.h"40 39 41 40 namespace orxonox 42 41 { 43 CreateFactory(ExtendedInputState);44 45 42 using namespace InputDevice; 46 47 ExtendedInputState::ExtendedInputState()48 {49 RegisterObject(ExtendedInputState);50 }51 43 52 44 void ExtendedInputState::numberOfJoySticksChanged(unsigned int n) -
code/branches/gui/src/core/input/ExtendedInputState.h
r1646 r1653 48 48 { 49 49 friend class InputManager; 50 friend class ClassFactory<ExtendedInputState>;51 50 52 51 public: … … 68 67 69 68 private: 70 ExtendedInputState() ;69 ExtendedInputState() { } 71 70 ~ExtendedInputState() { } 72 71 -
code/branches/gui/src/core/input/InputManager.cc
r1646 r1653 161 161 setConfigValues(); 162 162 163 stateEmpty_ = create SimpleInputState("empty", -1);163 stateEmpty_ = createInputState<SimpleInputState>("empty", -1); 164 164 stateEmpty_->setHandler(new EmptyHandler()); 165 165 activeStates_[stateEmpty_->getPriority()] = stateEmpty_; 166 166 167 stateDetector_ = create SimpleInputState("detector", 101);167 stateDetector_ = createInputState<SimpleInputState>("detector", 101); 168 168 KeyDetector* temp = new KeyDetector(); 169 169 temp->loadBindings("storeKeyStroke"); 170 170 stateDetector_->setHandler(temp); 171 171 172 stateCalibrator_ = create SimpleInputState("calibrator", 100);172 stateCalibrator_ = createInputState<SimpleInputState>("calibrator", 100); 173 173 stateCalibrator_->setHandler(new EmptyHandler()); 174 174 InputBuffer* buffer = new InputBuffer(); … … 1037 1037 /** 1038 1038 @brief 1039 Returns a new SimpleInputState and configures it first.1040 */1041 SimpleInputState* InputManager::createSimpleInputState(const std::string &name, int priority)1042 {1043 SimpleInputState* state = new SimpleInputState();1044 if (_configureInputState(state, name, priority))1045 return state;1046 else1047 {1048 delete state;1049 return 0;1050 }1051 }1052 1053 /**1054 @brief1055 Returns a new ExtendedInputState and configures it first.1056 */1057 ExtendedInputState* InputManager::createExtendedInputState(const std::string &name, int priority)1058 {1059 ExtendedInputState* state = new ExtendedInputState();1060 if (_configureInputState(state, name, priority))1061 return state;1062 else1063 {1064 delete state;1065 return 0;1066 }1067 }1068 1069 /**1070 @brief1071 Returns a new InputState of type 'type' and configures it first.1072 @param type1073 String name of the class (used by the factory)1074 */1075 InputState* InputManager::createInputState(const std::string& type, const std::string &name, int priority)1076 {1077 InputState* state = dynamic_cast<InputState*>(Factory::getIdentifier(type)->fabricate());1078 if (_configureInputState(state, name, priority))1079 return state;1080 else1081 {1082 delete state;1083 return 0;1084 }1085 }1086 1087 /**1088 @brief1089 1039 Removes an input state internally. 1090 1040 @param name -
code/branches/gui/src/core/input/InputManager.h
r1645 r1653 102 102 void setWindowExtents(const int width, const int height); 103 103 104 SimpleInputState* createSimpleInputState (const std::string& name, int priority); 105 ExtendedInputState* createExtendedInputState(const std::string& name, int priority); 106 InputState* createInputState(const std::string& type, const std::string &name, int priority); 104 template <class T> 105 T* createInputState(const std::string& name, int priority) 106 { 107 T* state = new T; 108 if (_configureInputState(state, name, priority)) 109 return state; 110 else 111 { 112 delete state; 113 return 0; 114 } 115 } 116 107 117 bool destroyState (const std::string& name); 108 118 InputState* getState (const std::string& name); -
code/branches/gui/src/core/input/InputState.h
r1646 r1653 40 40 #include <vector> 41 41 #include "core/Executor.h" 42 #include "core/BaseObject.h"43 #include "core/CoreIncludes.h"44 42 #include "InputInterfaces.h" 45 43 46 44 namespace orxonox 47 45 { 48 class _CoreExport InputState : public BaseObject46 class _CoreExport InputState 49 47 { 50 48 friend class InputManager; … … 89 87 90 88 protected: 91 InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0) 92 { RegisterObject(InputState); } 89 InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0) { } 93 90 virtual ~InputState() { } 94 91 -
code/branches/gui/src/core/input/KeyDetector.cc
r1638 r1653 68 68 void KeyDetector::loadBindings(const std::string& command) 69 69 { 70 this->command_ = command; 70 71 clearBindings(); 71 72 setConfigValues(); 72 this->command_ = command;73 73 } 74 74 -
code/branches/gui/src/core/input/SimpleInputState.cc
r1642 r1653 38 38 #include "core/Debug.h" 39 39 #include "core/Executor.h" 40 #include "core/CoreIncludes.h"41 40 42 41 namespace orxonox 43 42 { 44 CreateFactory(SimpleInputState);45 46 43 using namespace InputDevice; 47 44 … … 51 48 , joyStickHandlerAll_(0) 52 49 { 53 RegisterObject(SimpleInputState);54 50 } 55 51 -
code/branches/gui/src/core/input/SimpleInputState.h
r1646 r1653 46 46 { 47 47 friend class InputManager; 48 friend class ClassFactory<SimpleInputState>;49 48 50 49 public:
Note: See TracChangeset
for help on using the changeset viewer.