W3DMouse.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. ** Command & Conquer Generals(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: W3DMouse.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: Win32Mouse.h
  36. //
  37. // Created: Mark Wilczynski, Jan 2002
  38. //
  39. // Desc: Interface for the mouse using W3D methods to display cursor.
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. #pragma once
  44. #ifndef __W3DMOUSE_H_
  45. #define __W3DMOUSE_H_
  46. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  47. // USER INCLUDES //////////////////////////////////////////////////////////////
  48. #include "Win32Device/GameClient/Win32Mouse.h"
  49. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  50. class CameraClass;
  51. class SurfaceClass;
  52. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  53. // W3DMouse -----------------------------------------------------------------
  54. /** Mouse interface for when using only the Win32 messages and W3D for cursor */
  55. //-----------------------------------------------------------------------------
  56. class W3DMouse : public Win32Mouse
  57. {
  58. public:
  59. W3DMouse( void );
  60. virtual ~W3DMouse( void );
  61. virtual void init( void ); ///< init mouse, extend this functionality, do not replace
  62. virtual void reset( void ); ///< reset the system
  63. virtual void setCursor( MouseCursor cursor ); ///< set mouse cursor
  64. virtual void draw( void ); ///< draw the cursor or refresh the image
  65. virtual void setRedrawMode(RedrawMode mode); ///<set cursor drawing method.
  66. private:
  67. MouseCursor m_currentD3DCursor; ///< keep track of last cursor image sent to D3D.
  68. SurfaceClass *m_currentD3DSurface[MAX_2D_CURSOR_ANIM_FRAMES];
  69. ICoord2D m_currentHotSpot;
  70. Int m_currentFrames; ///< total number of frames in current 2D cursor animation.
  71. Real m_currentAnimFrame;///< current frame of 2D cursor animation.
  72. Int m_currentD3DFrame; ///< current frame actually sent to the hardware.
  73. Int m_lastAnimTime; ///< ms at last animation update.
  74. Real m_currentFMS; ///< frames per ms.
  75. Bool m_drawing; ///< flag to indicate mouse cursor is currently in the act of drawing.
  76. ///@todo: remove the textures if we only need surfaces
  77. void initD3DAssets(void); ///< load textures for mouse cursors, etc.
  78. void freeD3DAssets(void); ///< unload textures used by mouse cursors.
  79. Bool loadD3DCursorTextures(MouseCursor cursor); ///<load the textures/animation for given cursor.
  80. Bool releaseD3DCursorTextures(MouseCursor cursor); ///<release loaded textures for cursor.
  81. // W3D animated model cursor
  82. CameraClass *m_camera; ///< our camera
  83. MouseCursor m_currentW3DCursor;
  84. void initW3DAssets(void); ///< load models for mouse cursors, etc.
  85. void freeW3DAssets(void); ///< unload models used by mouse cursors.
  86. MouseCursor m_currentPolygonCursor;
  87. void initPolygonAssets(void); ///< load images for cursor polygon.
  88. void freePolygonAssets(void); ///< free images for cursor polygon.
  89. void setCursorDirection(MouseCursor cursor); ///figure out direction for oriented 2D cursors.
  90. }; // end Win32Mouse
  91. // INLINING ///////////////////////////////////////////////////////////////////
  92. // EXTERNALS //////////////////////////////////////////////////////////////////
  93. #endif // __W3DMOUSE_H_