/src/ois/includes/win32/Win32KeyBoard.h

https://bitbucket.org/cabalistic/ogredeps/ · C Header · 87 lines · 31 code · 14 blank · 42 comment · 0 complexity · c452a0dceca69a827aadcf1314633f99 MD5 · raw file

  1. /*
  2. The zlib/libpng License
  3. Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
  4. This software is provided 'as-is', without any express or implied warranty. In no event will
  5. the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose, including commercial
  7. applications, and to alter it and redistribute it freely, subject to the following
  8. restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that
  10. you wrote the original software. If you use this software in a product,
  11. an acknowledgment in the product documentation would be appreciated but is
  12. not required.
  13. 2. Altered source versions must be plainly marked as such, and must not be
  14. misrepresented as being the original software.
  15. 3. This notice may not be removed or altered from any source distribution.
  16. */
  17. #ifndef _WIN32_KEYBOARD_H_EADER_
  18. #define _WIN32_KEYBOARD_H_EADER_
  19. #include "OISKeyboard.h"
  20. #include "win32/Win32Prereqs.h"
  21. namespace OIS
  22. {
  23. class Win32Keyboard : public Keyboard
  24. {
  25. public:
  26. /**
  27. @remarks
  28. Constructor
  29. @param pDI
  30. Valid DirectInput8 Interface
  31. @param buffered
  32. True for buffered input mode
  33. @param coopSettings
  34. A combination of DI Flags (see DX Help for info on input device settings)
  35. */
  36. Win32Keyboard(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings);
  37. virtual ~Win32Keyboard();
  38. /** @copydoc Keyboard::isKeyDown */
  39. virtual bool isKeyDown(KeyCode key) const;
  40. /** @copydoc Keyboard::getAsString */
  41. virtual const std::string& getAsString(KeyCode kc);
  42. /** @copydoc Keyboard::copyKeyStates */
  43. virtual void copyKeyStates(char keys[256]) const;
  44. /** @copydoc Object::setBuffered */
  45. virtual void setBuffered(bool buffered);
  46. /** @copydoc Object::capture */
  47. virtual void capture();
  48. /** @copydoc Object::queryInterface */
  49. virtual Interface* queryInterface(Interface::IType type) {return 0;}
  50. /** @copydoc Object::_initialize */
  51. virtual void _initialize();
  52. protected:
  53. void _readBuffered();
  54. void _read();
  55. IDirectInput8* mDirectInput;
  56. IDirectInputDevice8* mKeyboard;
  57. DWORD coopSetting;
  58. unsigned char KeyBuffer[256];
  59. //! Internal method for translating KeyCodes to Text
  60. int _translateText( KeyCode kc );
  61. //! Stored dead key from last translation
  62. WCHAR deadKey;
  63. //! used for getAsString
  64. std::string mGetString;
  65. };
  66. }
  67. #endif //_WIN32_KEYBOARD_H_EADER_