Changeset 1293 for code/trunk/src/core/InputManager.h
- Timestamp:
- May 15, 2008, 5:44:55 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/InputManager.h
r1219 r1293 39 39 40 40 #include <map> 41 #include < list>41 #include <vector> 42 42 43 43 #include "ois/OIS.h" 44 44 #include "Tickable.h" 45 #include "InputInterfaces.h" 45 46 46 47 namespace orxonox 47 48 { 48 class Mouse : public OIS::Mouse49 {50 };51 52 49 /** 53 50 @brief Captures and distributes mouse and keyboard input. 54 51 */ 55 52 class _CoreExport InputManager 56 : public Tickable ,53 : public TickableReal, 57 54 public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener 58 55 { … … 72 69 73 70 public: // static functions 74 static bool initialise(const size_t windowHnd, const int windowWidth, constint windowHeight,75 const bool createKeyboard = true, const bool createMouse = true, constbool createJoySticks = false);71 static bool initialise(const size_t windowHnd, int windowWidth, int windowHeight, 72 bool createKeyboard = true, bool createMouse = true, bool createJoySticks = false); 76 73 static bool initialiseKeyboard(); 77 74 static bool initialiseMouse(); … … 85 82 static void destroyMouse(); 86 83 static void destroyJoySticks(); 84 85 static bool isModifierDown(KeyboardModifier::Enum modifier); 86 static bool isKeyDown(KeyCode::Enum key); 87 static const MouseState getMouseState(); 88 static const JoyStickState getJoyStickState(unsigned int ID); 87 89 88 90 static void setWindowExtents(const int width, const int height); … … 108 110 static bool removeJoyStickHandler (const std::string& name); 109 111 static JoyStickHandler* getJoyStickHandler(const std::string& name); 110 static bool enableJoyStickHandler (const std::string& name, const int id); 111 static bool disableJoyStickHandler (const std::string& name, const int id); 112 static bool isJoyStickHandlerActive (const std::string& name, const int id); 113 114 // Temporary solutions. Will be removed soon! 115 static OIS::Mouse* getMouse() { return _getSingleton().mouse_ ; } 116 static OIS::Keyboard* getKeyboard() { return _getSingleton().keyboard_; } 112 static bool enableJoyStickHandler (const std::string& name, unsigned int id); 113 static bool disableJoyStickHandler (const std::string& name, unsigned int id); 114 static bool isJoyStickHandlerActive (const std::string& name, unsigned int id); 117 115 118 116 private: // functions … … 123 121 124 122 // Intenal methods 125 bool _initialise(const size_t, const int, const int, const bool, const bool, constbool);123 bool _initialise(const size_t, int, int, bool, bool, bool); 126 124 bool _initialiseKeyboard(); 127 125 bool _initialiseMouse(); … … 133 131 void _destroyJoySticks(); 134 132 135 //void _setNumberOfJoysticks(int size);136 137 133 void tick(float dt); 138 134 139 135 // input events 140 141 136 bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButtonID id); 137 bool mouseReleased (const OIS::MouseEvent &arg, OIS::MouseButtonID id); 142 138 bool mouseMoved (const OIS::MouseEvent &arg); 143 144 145 146 147 148 149 150 139 bool keyPressed (const OIS::KeyEvent &arg); 140 bool keyReleased (const OIS::KeyEvent &arg); 141 bool buttonPressed (const OIS::JoyStickEvent &arg, int button); 142 bool buttonReleased(const OIS::JoyStickEvent &arg, int button); 143 bool axisMoved (const OIS::JoyStickEvent &arg, int axis); 144 bool sliderMoved (const OIS::JoyStickEvent &arg, int id); 145 bool povMoved (const OIS::JoyStickEvent &arg, int id); 146 bool vector3Moved (const OIS::JoyStickEvent &arg, int id); 151 147 152 148 static InputManager& _getSingleton(); … … 158 154 OIS::Mouse* mouse_; //!< OIS keyboard 159 155 std::vector<OIS::JoyStick*> joySticks_; //!< OIS joy sticks 156 unsigned int joySticksSize_; 160 157 161 158 InputState state_; 162 159 InputState stateRequest_; 160 unsigned int keyboardModifiers_; 163 161 164 162 std::map<std::string, KeyHandler*> keyHandlers_; … … 168 166 std::vector<KeyHandler*> activeKeyHandlers_; 169 167 std::vector<MouseHandler*> activeMouseHandlers_; 170 std:: map< OIS::JoyStick*,std::vector<JoyStickHandler*> > activeJoyStickHandlers_;168 std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_; 171 169 172 std:: list<OIS::KeyCode>keysDown_;173 std:: list<OIS::MouseButtonID>mouseButtonsDown_;174 std:: map< OIS::JoyStick*, std::list<int> >joyStickButtonsDown_;170 std::vector<Key> keysDown_; 171 std::vector<MouseButton::Enum> mouseButtonsDown_; 172 std::vector<std::vector<int> > joyStickButtonsDown_; 175 173 176 174 }; 175 177 176 } 178 177
Note: See TracChangeset
for help on using the changeset viewer.