Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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