Win32DIMouse.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. // FILE: Win32DIMouse.h ///////////////////////////////////////////////////////
  19. //-----------------------------------------------------------------------------
  20. //
  21. // Westwood Studios Pacific.
  22. //
  23. // Confidential Information
  24. // Copyright (C) 2001 - All Rights Reserved
  25. //
  26. //-----------------------------------------------------------------------------
  27. //
  28. // Project: RTS3
  29. //
  30. // File name: Win32DIMouse.h
  31. //
  32. // Created: Colin Day, June 2001
  33. //
  34. // Desc: Win32 direct input implementation for the mouse
  35. //
  36. //-----------------------------------------------------------------------------
  37. ///////////////////////////////////////////////////////////////////////////////
  38. #pragma once
  39. #ifndef __WIN32DIMOUSE_H_
  40. #define __WIN32DIMOUSE_H_
  41. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  42. #ifndef DIRECTINPUT_VERSION
  43. # define DIRECTINPUT_VERSION 0x800
  44. #endif
  45. #include <dinput.h>
  46. // USER INCLUDES //////////////////////////////////////////////////////////////
  47. #include "GameClient/Mouse.h"
  48. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  49. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  50. // class DirectInputMouse -----------------------------------------------------
  51. /** Direct input implementation for the mouse device */
  52. //-----------------------------------------------------------------------------
  53. class DirectInputMouse : public Mouse
  54. {
  55. public:
  56. DirectInputMouse( void );
  57. virtual ~DirectInputMouse( void );
  58. // extended methods from base class
  59. virtual void init( void ); ///< initialize the direct input mouse, extending functionality
  60. virtual void reset( void ); ///< reset system
  61. virtual void update( void ); ///< update the mouse data, extending functionality
  62. virtual void setPosition( Int x, Int y ); ///< set position for mouse
  63. virtual void setMouseLimits( void ); ///< update the limit extents the mouse can move in
  64. virtual void setCursor( MouseCursor cursor ); ///< set mouse cursor
  65. virtual void capture( void ); ///< capture the mouse
  66. virtual void releaseCapture( void ); ///< release mouse capture
  67. protected:
  68. /// device implementation to get mouse event
  69. virtual UnsignedByte getMouseEvent( MouseIO *result, Bool flush );
  70. // new internal methods for our direct input implemetation
  71. void openMouse( void ); ///< create the direct input mouse
  72. void closeMouse( void ); ///< close and release mouse resources
  73. /// map direct input mouse data to our own format
  74. void mapDirectInputMouse( MouseIO *mouse, DIDEVICEOBJECTDATA *mdat );
  75. // internal data members for our direct input mouse
  76. LPDIRECTINPUT8 m_pDirectInput; ///< pointer to direct input interface
  77. LPDIRECTINPUTDEVICE8 m_pMouseDevice; ///< pointer to mouse device
  78. }; // end class DirectInputMouse
  79. // INLINING ///////////////////////////////////////////////////////////////////
  80. // EXTERNALS //////////////////////////////////////////////////////////////////
  81. #endif // __WIN32DIMOUSE_H_