W3DGameClient.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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: W3DGameClient.h ///////////////////////////////////////////////////
  24. //
  25. // W3D implementation of the game interface. The GameClient is
  26. // responsible for maintaining our drawbles, handling our GUI, and creating
  27. // the display ... basically the Client if this were a Client/Server game.
  28. //
  29. // Author: Colin Day, April 2001
  30. //
  31. ///////////////////////////////////////////////////////////////////////////////
  32. #pragma once
  33. #ifndef __W3DGAMEINTERFACE_H_
  34. #define __W3DGAMEINTERFACE_H_
  35. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  36. // USER INCLUDES //////////////////////////////////////////////////////////////
  37. #include "GameClient/GameClient.h"
  38. #include "W3DDevice/GameClient/W3DParticleSys.h"
  39. #include "W3DDevice/GameClient/W3DDisplay.h"
  40. #include "W3DDevice/GameClient/W3DInGameUI.h"
  41. #include "W3DDevice/GameClient/W3DTerrainVisual.h"
  42. #include "W3DDevice/GameClient/W3DGameWindowManager.h"
  43. #include "W3DDevice/GameClient/W3DGameFont.h"
  44. #include "W3DDevice/GameClient/W3DDisplayStringManager.h"
  45. #include "VideoDevice/Bink/BinkVideoPlayer.h"
  46. #include "Win32Device/GameClient/Win32DIKeyboard.h"
  47. #include "Win32Device/GameClient/Win32DIMouse.h"
  48. #include "Win32Device/GameClient/Win32Mouse.h"
  49. #include "W3DDevice/GameClient/W3DMouse.h"
  50. #include "W3DDevice/GameClient/W3DSnow.h"
  51. class ThingTemplate;
  52. extern Win32Mouse *TheWin32Mouse;
  53. ///////////////////////////////////////////////////////////////////////////////
  54. // PROTOTYPES /////////////////////////////////////////////////////////////////
  55. ///////////////////////////////////////////////////////////////////////////////
  56. // W3DGameClient -----------------------------------------------------------
  57. /** The W3DGameClient singleton */
  58. //-----------------------------------------------------------------------------
  59. class W3DGameClient : public GameClient
  60. {
  61. public:
  62. W3DGameClient();
  63. virtual ~W3DGameClient();
  64. /// given a type, create a drawable
  65. virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE );
  66. virtual void init( void ); ///< initialize resources
  67. virtual void update( void ); ///< per frame update
  68. virtual void reset( void ); ///< reset system
  69. virtual void addScorch(const Coord3D *pos, Real radius, Scorches type);
  70. virtual void createRayEffectByTemplate( const Coord3D *start, const Coord3D *end, const ThingTemplate* tmpl ); ///< create effect needing start and end location
  71. //virtual Bool getBonePos(Drawable *draw, AsciiString boneName, Coord3D* pos, Matrix3D* transform) const;
  72. virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now
  73. //---------------------------------------------------------------------------
  74. virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!!
  75. virtual void adjustLOD( Int adj ); ///< @todo hack for evaluation, remove.
  76. virtual void notifyTerrainObjectMoved(Object *obj);
  77. protected:
  78. virtual Keyboard *createKeyboard( void ); ///< factory for the keyboard
  79. virtual Mouse *createMouse( void ); ///< factory for the mouse
  80. /// factory for creating TheDisplay
  81. virtual Display *createGameDisplay( void ) { return NEW W3DDisplay; }
  82. /// factory for creating TheInGameUI
  83. virtual InGameUI *createInGameUI( void ) { return NEW W3DInGameUI; }
  84. /// factory for creating the window manager
  85. virtual GameWindowManager *createWindowManager( void ) { return NEW W3DGameWindowManager; }
  86. /// factory for creating the font library
  87. virtual FontLibrary *createFontLibrary( void ) { return NEW W3DFontLibrary; }
  88. /// Manager for display strings
  89. virtual DisplayStringManager *createDisplayStringManager( void ) { return NEW W3DDisplayStringManager; }
  90. virtual VideoPlayerInterface *createVideoPlayer( void ) { return NEW BinkVideoPlayer; }
  91. /// factory for creating the TerrainVisual
  92. virtual TerrainVisual *createTerrainVisual( void ) { return NEW W3DTerrainVisual; }
  93. /// factory for creating the snow manager
  94. virtual SnowManager *createSnowManager( void ) { return NEW W3DSnowManager; }
  95. virtual void setFrameRate(Real msecsPerFrame) { TheW3DFrameLengthInMsec = msecsPerFrame; }
  96. }; // end class W3DGameClient
  97. inline Keyboard *W3DGameClient::createKeyboard( void ) { return NEW DirectInputKeyboard; }
  98. inline Mouse *W3DGameClient::createMouse( void )
  99. {
  100. //return new DirectInputMouse;
  101. Win32Mouse * mouse = NEW W3DMouse;
  102. TheWin32Mouse = mouse; ///< global cheat for the WndProc()
  103. return mouse;
  104. }
  105. #endif // end __W3DGAMEINTERFACE_H_