Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/shader/src/asylum/orxonox/InputManager.h @ 10241

Last change on this file since 10241 was 1505, checked in by rgrieder, 17 years ago

f* svn: It doesn't even inform you if you attempt to set a non existing property. It is svn:eol-style and not eol-style when using the command by the way…

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
1#ifndef _InputManager_H__
2#define _InputManager_H__
3
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
10#include <OISMouse.h>
11#include <OISKeyboard.h>
12#include <OISJoyStick.h>
13#include <OISInputManager.h>
14#endif
15
16#include <OgreRenderWindow.h>
17
18#include "OrxonoxPrereqs.h"
19
20class _OrxonoxExport InputManager : public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener {
21  public:
22    virtual ~InputManager( void );
23
24    void initialise( Ogre::RenderWindow *renderWindow );
25    void capture( void );
26
27    void addKeyListener( OIS::KeyListener *keyListener, const std::string& instanceName );
28    void addMouseListener( OIS::MouseListener *mouseListener, const std::string& instanceName );
29    void addJoystickListener( OIS::JoyStickListener *joystickListener, const std::string& instanceName );
30
31    void removeKeyListener( const std::string& instanceName );
32    void removeMouseListener( const std::string& instanceName );
33    void removeJoystickListener( const std::string& instanceName );
34
35    void removeKeyListener( OIS::KeyListener *keyListener );
36    void removeMouseListener( OIS::MouseListener *mouseListener );
37    void removeJoystickListener( OIS::JoyStickListener *joystickListener );
38
39    void removeAllListeners( void );
40    void removeAllKeyListeners( void );
41    void removeAllMouseListeners( void );
42    void removeAllJoystickListeners( void );
43
44    void setWindowExtents( int width, int height );
45
46    OIS::Mouse*    getMouse( void );
47    OIS::Keyboard* getKeyboard( void );
48    OIS::JoyStick* getJoystick( unsigned int index );
49
50    int getNumOfJoysticks( void );
51
52    static InputManager* getSingletonPtr( void );
53  private:
54    InputManager( void );
55    InputManager( const InputManager& ) { }
56    InputManager & operator = ( const InputManager& );
57
58    bool keyPressed( const OIS::KeyEvent &e );
59    bool keyReleased( const OIS::KeyEvent &e );
60
61    bool mouseMoved( const OIS::MouseEvent &e );
62    bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id );
63    bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id );
64
65    bool povMoved( const OIS::JoyStickEvent &e, int pov );
66    bool axisMoved( const OIS::JoyStickEvent &e, int axis );
67    bool sliderMoved( const OIS::JoyStickEvent &e, int sliderID );
68    bool buttonPressed( const OIS::JoyStickEvent &e, int button );
69    bool buttonReleased( const OIS::JoyStickEvent &e, int button );
70
71    OIS::Mouse        *mMouse;
72    OIS::Keyboard     *mKeyboard;
73    OIS::InputManager *mInputSystem;
74
75    std::vector<OIS::JoyStick*> mJoysticks;
76    std::vector<OIS::JoyStick*>::iterator itJoystick;
77    std::vector<OIS::JoyStick*>::iterator itJoystickEnd;
78
79    std::map<std::string, OIS::KeyListener*> mKeyListeners;
80    std::map<std::string, OIS::MouseListener*> mMouseListeners;
81    std::map<std::string, OIS::JoyStickListener*> mJoystickListeners;
82
83    std::map<std::string, OIS::KeyListener*>::iterator itKeyListener;
84    std::map<std::string, OIS::MouseListener*>::iterator itMouseListener;
85    std::map<std::string, OIS::JoyStickListener*>::iterator itJoystickListener;
86
87    std::map<std::string, OIS::KeyListener*>::iterator itKeyListenerEnd;
88    std::map<std::string, OIS::MouseListener*>::iterator itMouseListenerEnd;
89    std::map<std::string, OIS::JoyStickListener*>::iterator itJoystickListenerEnd;
90
91    static InputManager *mInputManager;
92};
93#endif /* _InputManager_H__ */
Note: See TracBrowser for help on using the repository browser.