Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/InputManager.h @ 552

Last change on this file since 552 was 533, checked in by rgrieder, 17 years ago
  • some minor changes in order to make the project compile with VC08 (doesn't yet)
File size: 3.3 KB
RevLine 
[512]1#ifndef InputManager_H
2#define InputManager_H
3
[533]4#ifdef WIN32
5#include <OIS/OISMouse.h>
6#include <OIS/OISKeyboard.h>
7#include <OIS/OISJoyStick.h>
8#include <OIS/OISInputManager.h>
9#else
[512]10#include <OISMouse.h>
11#include <OISKeyboard.h>
12#include <OISJoyStick.h>
13#include <OISInputManager.h>
[533]14#endif
[512]15
16#include <OgreRenderWindow.h>
17
18class InputManager : public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener {
19  public:
20    virtual ~InputManager( void );
21
22    void initialise( Ogre::RenderWindow *renderWindow );
23    void capture( void );
24
25    void addKeyListener( OIS::KeyListener *keyListener, const std::string& instanceName );
26    void addMouseListener( OIS::MouseListener *mouseListener, const std::string& instanceName );
27    void addJoystickListener( OIS::JoyStickListener *joystickListener, const std::string& instanceName );
28
29    void removeKeyListener( const std::string& instanceName );
30    void removeMouseListener( const std::string& instanceName );
31    void removeJoystickListener( const std::string& instanceName );
32
33    void removeKeyListener( OIS::KeyListener *keyListener );
34    void removeMouseListener( OIS::MouseListener *mouseListener );
35    void removeJoystickListener( OIS::JoyStickListener *joystickListener );
36
37    void removeAllListeners( void );
38    void removeAllKeyListeners( void );
39    void removeAllMouseListeners( void );
40    void removeAllJoystickListeners( void );
41
42    void setWindowExtents( int width, int height );
43
44    OIS::Mouse*    getMouse( void );
45    OIS::Keyboard* getKeyboard( void );
46    OIS::JoyStick* getJoystick( unsigned int index );
47
48    int getNumOfJoysticks( void );
49
50    static InputManager* getSingletonPtr( void );
51  private:
52    InputManager( void );
53    InputManager( const InputManager& ) { }
54    InputManager & operator = ( const InputManager& );
55
56    bool keyPressed( const OIS::KeyEvent &e );
57    bool keyReleased( const OIS::KeyEvent &e );
58
59    bool mouseMoved( const OIS::MouseEvent &e );
60    bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id );
61    bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id );
62
63    bool povMoved( const OIS::JoyStickEvent &e, int pov );
64    bool axisMoved( const OIS::JoyStickEvent &e, int axis );
65    bool sliderMoved( const OIS::JoyStickEvent &e, int sliderID );
66    bool buttonPressed( const OIS::JoyStickEvent &e, int button );
67    bool buttonReleased( const OIS::JoyStickEvent &e, int button );
68
69    OIS::Mouse        *mMouse;
70    OIS::Keyboard     *mKeyboard;
71    OIS::InputManager *mInputSystem;
72
73    std::vector<OIS::JoyStick*> mJoysticks;
74    std::vector<OIS::JoyStick*>::iterator itJoystick;
75    std::vector<OIS::JoyStick*>::iterator itJoystickEnd;
76
77    std::map<std::string, OIS::KeyListener*> mKeyListeners;
78    std::map<std::string, OIS::MouseListener*> mMouseListeners;
79    std::map<std::string, OIS::JoyStickListener*> mJoystickListeners;
80
81    std::map<std::string, OIS::KeyListener*>::iterator itKeyListener;
82    std::map<std::string, OIS::MouseListener*>::iterator itMouseListener;
83    std::map<std::string, OIS::JoyStickListener*>::iterator itJoystickListener;
84
85    std::map<std::string, OIS::KeyListener*>::iterator itKeyListenerEnd;
86    std::map<std::string, OIS::MouseListener*>::iterator itMouseListenerEnd;
87    std::map<std::string, OIS::JoyStickListener*>::iterator itJoystickListenerEnd;
88
89    static InputManager *mInputManager;
90};
91#endif
Note: See TracBrowser for help on using the repository browser.