InputManager.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef INPUT_FILTER_H
  2. #define INPUT_FILTER_H
  3. #include <OgreSingleton.h>
  4. #include <OgreString.h>
  5. #include <OIS.h>
  6. #include <vector>
  7. #include "Event.h"
  8. typedef std::vector< QGears::Event > InputEventArray;
  9. typedef std::vector< int > ButtonList;
  10. class ConfigCmd;
  11. class InputManager : public Ogre::Singleton< InputManager >
  12. {
  13. public:
  14. InputManager();
  15. virtual ~InputManager();
  16. void ButtonPressed( int button, char text, bool down );
  17. void MousePressed( int button, bool down );
  18. void MouseMoved( int x, int y );
  19. void MouseScrolled( int value );
  20. void Reset();
  21. void Update();
  22. bool IsButtonPressed( int button ) const;
  23. void GetInputEvents( InputEventArray& input_events );
  24. // binds
  25. void InitCmd();
  26. void BindCommand( ConfigCmd* cmd, const Ogre::StringVector& params, const ButtonList& buttons );
  27. void BindGameEvent( const Ogre::String& event, const ButtonList& buttons );
  28. void ActivateBinds( const int button );
  29. void AddGameEvents( const int button, const QGears::EventType type );
  30. private:
  31. bool m_ButtonState[ 256 ];
  32. char m_ButtonText[ 256 ];
  33. bool m_RepeatFirstWait;
  34. float m_RepeatTimer;
  35. InputEventArray m_EventQueue;
  36. // binds
  37. struct BindInfo
  38. {
  39. BindInfo():
  40. cmd( NULL )
  41. {}
  42. ConfigCmd* cmd;
  43. Ogre::StringVector params;
  44. ButtonList buttons;
  45. };
  46. std::vector< BindInfo > m_Binds;
  47. struct BindGameEventInfo
  48. {
  49. Ogre::String event;
  50. ButtonList buttons;
  51. };
  52. std::vector< BindGameEventInfo > m_BindGameEvents;
  53. };
  54. #endif // INPUT_FILTER_H