#ifndef InputManager_HPP #define InputManager_HPP #include #include #include #include #include #include typedef struct { unsigned int keycode; unsigned int text; int pressedReleased; } keyEvent_t; typedef struct { int abs; int rel; int absOnly; // Indicates if this Axis only supports Absolute (ie JoyStick) } axis_t; typedef struct { axis_t X; axis_t Y; axis_t Z; int buttonId; int pressedReleasedMoved; } mouseEvent_t; class InputManager : public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener { public: InputManager( void ); ~InputManager( void ); void initialize( Ogre::RenderWindow *renderWindow, char * optKeys[], char * optVals[], int nOpts ); void capture( void ); void setWindowExtents( int width, int height ); OIS::Mouse* getMouse( void ); OIS::Keyboard* getKeyboard( void ); OIS::JoyStick* getJoystick( unsigned int index ); int getNumOfJoysticks( void ); std::stack keyboardStack; std::stack mouseStack; private: 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; }; #endif