InputManager.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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< Event > InputEventArray;
  9. typedef std::vector< int > ButtonList;
  10. class InputManager : public Ogre::Singleton< InputManager >
  11. {
  12. public:
  13. InputManager();
  14. virtual ~InputManager();
  15. void ButtonPressed( int button, char text, bool down );
  16. void MousePressed( int button, bool down );
  17. void MouseMoved( int x, int y );
  18. void MouseScrolled( int value );
  19. void Reset();
  20. void Update();
  21. bool IsButtonPressed( int button ) const;
  22. void GetInputEvents( InputEventArray& input_events );
  23. // binds
  24. void InitCmd();
  25. void BindCommand( const Ogre::String& cmd, const ButtonList& buttons );
  26. void ActivateBinds( int button );
  27. private:
  28. struct BindInfo
  29. {
  30. BindInfo( const Ogre::String& _cmd, const ButtonList& _key_set ):
  31. cmd( _cmd ),
  32. key_set( _key_set )
  33. {}
  34. ButtonList key_set;
  35. Ogre::String cmd;
  36. };
  37. bool m_ButtonState[ 256 ];
  38. char m_ButtonText[ 256 ];
  39. bool m_RepeatFirstWait;
  40. float m_RepeatTimer;
  41. InputEventArray m_EventQueue;
  42. // binds
  43. std::vector< BindInfo > m_Binds;
  44. };
  45. #endif // INPUT_FILTER_H