Changeset 1642 for code/branches/gui/src/core/input/InputManager.h
- Timestamp:
- Jul 23, 2008, 3:37:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/input/InputManager.h
r1641 r1642 86 86 // --> setConfigValues is private 87 87 friend ClassIdentifier<InputManager>; 88 89 public: // static functions 90 static bool initialise(const size_t windowHnd, int windowWidth, int windowHeight, 88 // let Core class use tick(.) 89 friend Core; 90 91 public: 92 InputManager (); 93 ~InputManager(); 94 95 bool initialise(const size_t windowHnd, int windowWidth, int windowHeight, 91 96 bool createKeyboard = true, bool createMouse = true, bool createJoySticks = false); 92 static int numberOfKeyboards(); 93 static int numberOfMice(); 94 static int numberOfJoySticks(); 95 96 static void destroy(); 97 98 //static bool isModifierDown(KeyboardModifier::Enum modifier); 99 //static bool isKeyDown(KeyCode::Enum key); 100 //static const MouseState getMouseState(); 101 //static const JoyStickState getJoyStickState(unsigned int ID); 102 103 static void setWindowExtents(const int width, const int height); 104 97 98 int numberOfKeyboards() { return keyboard_ ? 1 : 0; } 99 int numberOfMice() { return mouse_ ? 1 : 0; } 100 int numberOfJoySticks() { return joySticksSize_; } 101 102 void setWindowExtents(const int width, const int height); 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); 107 bool destroyState (const std::string& name); 108 InputState* getState (const std::string& name); 109 InputState* getCurrentState(); 110 bool requestEnterState (const std::string& name); 111 bool requestLeaveState (const std::string& name); 112 113 static InputManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } 114 static InputManager* getInstancePtr() { return singletonRef_s; } 115 116 public: // console commands 105 117 static void storeKeyStroke(const std::string& name); 106 118 static void keyBind(const std::string& command); 107 108 119 static void calibrate(); 109 110 static void tick(float dt);111 112 static SimpleInputState* createSimpleInputState (const std::string& name, int priority);113 static ExtendedInputState* createExtendedInputState(const std::string& name, int priority);114 static bool destroyState (const std::string& name);115 static InputState* getState (const std::string& name);116 static InputState* getCurrentState();117 static bool requestEnterState (const std::string& name);118 static bool requestLeaveState (const std::string& name);119 120 120 121 private: // functions 121 122 // don't mess with a Singleton 122 InputManager ();123 123 InputManager (const InputManager&); 124 ~InputManager();125 124 126 125 // Intenal methods 127 bool _initialise(const size_t, int, int, bool, bool, bool);128 126 bool _initialiseKeyboard(); 129 127 bool _initialiseMouse(); … … 131 129 void _redimensionLists(); 132 130 133 void _destroy();134 131 void _destroyKeyboard(); 135 132 void _destroyMouse(); … … 142 139 unsigned int _getJoystick(const OIS::JoyStickEvent& arg); 143 140 144 void _tick(float dt);145 146 141 void _updateActiveStates(); 147 142 bool _configureInputState(InputState* state, const std::string& name, int priority); 143 144 void tick(float dt); 148 145 149 146 // input events … … 158 155 bool sliderMoved (const OIS::JoyStickEvent &arg, int id); 159 156 bool povMoved (const OIS::JoyStickEvent &arg, int id); 157 // don't remove that! Or else add OIS as dependency library to orxonox. 158 bool vector3Moved (const OIS::JoyStickEvent &arg, int id) { return true; } 160 159 161 160 void setConfigValues(); 162 163 static InputManager& _getInstance();164 161 165 162 private: // variables … … 204 201 205 202 static std::string bindingCommmandString_s; 206 };207 203 static InputManager* singletonRef_s; 204 }; 208 205 } 209 206
Note: See TracChangeset
for help on using the changeset viewer.