Win32DIKeyboard.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: Win32DIKeyboard.h ////////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Westwood Studios Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2001 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Project: RTS3
  34. //
  35. // File name: Win32DIKeyboard.h
  36. //
  37. // Created: Colin Day, June 2001
  38. //
  39. // Desc: Device implementation of the keyboard interface on Win32
  40. // using Microsoft Direct Input
  41. //
  42. //-----------------------------------------------------------------------------
  43. ///////////////////////////////////////////////////////////////////////////////
  44. #pragma once
  45. #ifndef __WIN32DIKEYBOARD_H_
  46. #define __WIN32DIKEYBOARD_H_
  47. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  48. #ifndef DIRECTINPUT_VERSION
  49. # define DIRECTINPUT_VERSION 0x800
  50. #endif
  51. #include <dinput.h>
  52. // USER INCLUDES //////////////////////////////////////////////////////////////
  53. #include "GameClient/Keyboard.h"
  54. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  55. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  56. // class DirectInputKeyboard --------------------------------------------------
  57. /** Class for interfacing with the keyboard using direct input as the
  58. * implementation */
  59. //-----------------------------------------------------------------------------
  60. class DirectInputKeyboard : public Keyboard
  61. {
  62. public:
  63. DirectInputKeyboard( void );
  64. virtual ~DirectInputKeyboard( void );
  65. // extend methods from the base class
  66. virtual void init( void ); ///< initialize the keyboard, extending init functionality
  67. virtual void reset( void ); ///< Reset the keybaord system
  68. virtual void update( void ); ///< update call, extending update functionality
  69. virtual Bool getCapsState( void ); ///< get state of caps lock key, return TRUE if down
  70. protected:
  71. // extended methods from the base class
  72. virtual void getKey( KeyboardIO *key ); ///< get a single key event
  73. //-----------------------------------------------------------------------------------------------
  74. // new methods to this derived class
  75. void openKeyboard( void ); ///< create direct input keyboard
  76. void closeKeyboard( void ); ///< release direct input keyboard
  77. // direct input data members
  78. LPDIRECTINPUT8 m_pDirectInput; ///< pointer to direct input interface
  79. LPDIRECTINPUTDEVICE8 m_pKeyboardDevice; ///< pointer to keyboard device
  80. }; // end class DirectInputKeyboard
  81. // INLINING ///////////////////////////////////////////////////////////////////
  82. // EXTERNALS //////////////////////////////////////////////////////////////////
  83. #endif // __WIN32DIKEYBOARD_H_