#ifndef _InputManager_H__ #define _InputManager_H__ #ifdef WIN32 #include #include #include #include #else #include #include #include #include #endif #include class InputManager : public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener { public: virtual ~InputManager( void ); void initialise( Ogre::RenderWindow *renderWindow ); void capture( void ); void addKeyListener( OIS::KeyListener *keyListener, const std::string& instanceName ); void addMouseListener( OIS::MouseListener *mouseListener, const std::string& instanceName ); void addJoystickListener( OIS::JoyStickListener *joystickListener, const std::string& instanceName ); void removeKeyListener( const std::string& instanceName ); void removeMouseListener( const std::string& instanceName ); void removeJoystickListener( const std::string& instanceName ); void removeKeyListener( OIS::KeyListener *keyListener ); void removeMouseListener( OIS::MouseListener *mouseListener ); void removeJoystickListener( OIS::JoyStickListener *joystickListener ); void removeAllListeners( void ); void removeAllKeyListeners( void ); void removeAllMouseListeners( void ); void removeAllJoystickListeners( void ); void setWindowExtents( int width, int height ); OIS::Mouse* getMouse( void ); OIS::Keyboard* getKeyboard( void ); OIS::JoyStick* getJoystick( unsigned int index ); int getNumOfJoysticks( void ); static InputManager* getSingletonPtr( void ); private: InputManager( void ); InputManager( const InputManager& ) { } InputManager & operator = ( const InputManager& ); bool keyPressed( const OIS::KeyEvent &e ); bool keyReleased( const OIS::KeyEvent &e ); bool mouseMoved( const OIS::MouseEvent &e ); bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id ); bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id ); bool povMoved( const OIS::JoyStickEvent &e, int pov ); bool axisMoved( const OIS::JoyStickEvent &e, int axis ); bool sliderMoved( const OIS::JoyStickEvent &e, int sliderID ); bool buttonPressed( const OIS::JoyStickEvent &e, int button ); bool buttonReleased( const OIS::JoyStickEvent &e, int button ); OIS::Mouse *mMouse; OIS::Keyboard *mKeyboard; OIS::InputManager *mInputSystem; std::vector mJoysticks; std::vector::iterator itJoystick; std::vector::iterator itJoystickEnd; std::map mKeyListeners; std::map mMouseListeners; std::map mJoystickListeners; std::map::iterator itKeyListener; std::map::iterator itMouseListener; std::map::iterator itJoystickListener; std::map::iterator itKeyListenerEnd; std::map::iterator itMouseListenerEnd; std::map::iterator itJoystickListenerEnd; static InputManager *mInputManager; }; #endif /* _InputManager_H__ */