ois-input-manager 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+78/−1 lines, 2 files
Files
- cbits/MyInputManager.hpp +75/−0
- ois-input-manager.cabal +3/−1
+ cbits/MyInputManager.hpp view
@@ -0,0 +1,75 @@+#ifndef InputManager_HPP+#define InputManager_HPP++#include <stack>++#include <OISMouse.h>+#include <OISKeyboard.h>+#include <OISJoyStick.h>+#include <OISInputManager.h>++#include <OgreRenderWindow.h>+ +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<keyEvent_t> keyboardStack;+ std::stack<mouseEvent_t> 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<OIS::JoyStick*> mJoysticks;+ std::vector<OIS::JoyStick*>::iterator itJoystick;+ std::vector<OIS::JoyStick*>::iterator itJoystickEnd;+};+#endif
ois-input-manager.cabal view
@@ -1,5 +1,5 @@ name: ois-input-manager-version: 0.1.0.0+version: 0.1.0.1 synopsis: wrapper for OIS input manager for use with hogre license: BSD3 license-file: LICENSE@@ -16,6 +16,8 @@ . This is a preview release. }++extra-source-files: cbits/MyInputManager.hpp library hs-source-dirs: src