Changeset 1204 for code/branches/input/src/core/InputManager.h
- Timestamp:
- Apr 30, 2008, 9:58:13 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/core/InputManager.h
r1203 r1204 43 43 #include "ois/OIS.h" 44 44 #include "Tickable.h" 45 //#include "InputEvent.h"46 #include "InputHandler.h"47 45 48 46 namespace orxonox … … 54 52 /** 55 53 @brief Captures and distributes mouse and keyboard input. 56 It resolves the key bindings to InputEvents which can be heard by57 implementing the InputEventListener interface.58 54 */ 59 55 class _CoreExport InputManager 60 56 : public Tickable, 61 public OIS:: MouseListener, public OIS::KeyListener, public OIS::JoyStickListener57 public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener 62 58 { 63 59 public: // enumerations … … 76 72 77 73 public: // static functions 78 static bool initialise( size_t windowHnd, int windowWidth,int windowHeight,79 bool createKeyboard = true, bool createMouse = true,bool createJoySticks = false);74 static bool initialise(const size_t windowHnd, const int windowWidth, const int windowHeight, 75 const bool createKeyboard = true, const bool createMouse = true, const bool createJoySticks = false); 80 76 static bool initialiseKeyboard(); 81 77 static bool initialiseMouse(); 82 78 static bool initialiseJoySticks(); 79 static bool isKeyboardInitialised(); 80 static bool isMouseInitialised(); 81 static bool areJoySticksInitialised(); 83 82 84 83 static void destroy(); … … 87 86 static void destroyJoySticks(); 88 87 89 static void setWindowExtents( int width,int height);88 static void setWindowExtents(const int width, const int height); 90 89 91 90 static void setInputState(const InputState state); 92 91 static InputState getInputState(); 93 static void setKeyBindingState (bool bActive);94 static void setMouseButtonBindingState (bool bActive);95 static void setJoyStickButtonBindingState(bool bActive);96 92 97 static bool addKey Listener(KeyHandler* listener, const std::string& name);98 static bool removeKey Listener(const std::string& name);99 static bool enableKeyListener(const std::string& name);100 static bool disableKeyListener(const std::string& name);101 static bool isKeyListenerActive(const std::string& name);102 static KeyHandler* getKeyListener(const std::string& name);93 static bool addKeyHandler (KeyHandler* handler, const std::string& name); 94 static bool removeKeyHandler (const std::string& name); 95 static KeyHandler* getKeyHandler (const std::string& name); 96 static bool enableKeyHandler (const std::string& name); 97 static bool disableKeyHandler (const std::string& name); 98 static bool isKeyHandlerActive (const std::string& name); 103 99 104 static bool addMouse Listener(MouseHandler* listener, const std::string& name);105 static bool removeMouse Listener(const std::string& name);106 static bool enableMouseListener(const std::string& name);107 static bool disableMouseListener(const std::string& name);108 static bool isMouseListenerActive(const std::string& name);109 static MouseHandler* getMouseListener(const std::string& name);100 static bool addMouseHandler (MouseHandler* handler, const std::string& name); 101 static bool removeMouseHandler (const std::string& name); 102 static MouseHandler* getMouseHandler (const std::string& name); 103 static bool enableMouseHandler (const std::string& name); 104 static bool disableMouseHandler (const std::string& name); 105 static bool isMouseHandlerActive (const std::string& name); 110 106 111 static bool addJoyStick Listener(JoyStickHandler* listener, const std::string& name);112 static bool removeJoyStick Listener(const std::string& name);113 static bool enableJoyStickListener (const std::string& name, const int id);114 static bool disableJoyStickListener(const std::string& name, const int id);115 static bool isJoyStickListenerActive(const std::string& name);116 static JoyStickHandler* getJoyStickListener(const std::string& name);107 static bool addJoyStickHandler (JoyStickHandler* handler, const std::string& name); 108 static bool removeJoyStickHandler (const std::string& name); 109 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); 117 113 118 114 // Temporary solutions. Will be removed soon! … … 127 123 128 124 // Intenal methods 129 bool _initialise( size_t, int, int, bool, bool,bool);125 bool _initialise(const size_t, const int, const int, const bool, const bool, const bool); 130 126 bool _initialiseKeyboard(); 131 127 bool _initialiseMouse(); … … 157 153 158 154 private: // variables 159 OIS::InputManager* inputSystem_;//!< OIS input manager160 OIS::Keyboard* keyboard_;//!< OIS mouse161 OIS::Mouse* mouse_;//!< OIS keyboard162 std::map<int, OIS::JoyStick*> joySticks_; //!< OIS joy sticks155 OIS::InputManager* inputSystem_; //!< OIS input manager 156 OIS::Keyboard* keyboard_; //!< OIS mouse 157 OIS::Mouse* mouse_; //!< OIS keyboard 158 std::map<int, OIS::JoyStick*> joySticks_; //!< OIS joy sticks 163 159 164 160 InputState state_; 165 161 InputState stateRequest_; 166 162 167 std::map<std::string, KeyHandler*> listenersKey_;168 std::map<std::string, MouseHandler*> listenersMouse_;169 std::map<std::string, JoyStickHandler*> listenersJoySticks_;163 std::map<std::string, KeyHandler*> keyHandlers_; 164 std::map<std::string, MouseHandler*> mouseHandlers_; 165 std::map<std::string, JoyStickHandler*> joyStickHandlers_; 170 166 171 std::list<KeyHandler*> listenersKeyActive_;172 std::list<MouseHandler*> listenersMouseActive_;173 std::map< int, std::list<JoyStickHandler*> > listenersJoySticksActive_;167 std::list<KeyHandler*> activeKeyHandlers_; 168 std::list<MouseHandler*> activeMouseHandlers_; 169 std::map<int, std::list<JoyStickHandler*> > activeJoyStickHandlers_; 174 170 175 std::list<OIS::KeyCode> keysDown_;176 std::list<OIS::MouseButtonID> mouseButtonsDown_;177 std::map< int, std::list<int> > joySticksButtonsDown_;171 std::list<OIS::KeyCode> keysDown_; 172 std::list<OIS::MouseButtonID> mouseButtonsDown_; 173 std::map< int, std::list<int> > joyStickButtonsDown_; 178 174 179 175 };
Note: See TracChangeset
for help on using the changeset viewer.