W3DGameClient.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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: 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. class ThingTemplate;
  51. extern Win32Mouse *TheWin32Mouse;
  52. ///////////////////////////////////////////////////////////////////////////////
  53. // PROTOTYPES /////////////////////////////////////////////////////////////////
  54. ///////////////////////////////////////////////////////////////////////////////
  55. // W3DGameClient -----------------------------------------------------------
  56. /** The W3DGameClient singleton */
  57. //-----------------------------------------------------------------------------
  58. class W3DGameClient : public GameClient
  59. {
  60. public:
  61. W3DGameClient();
  62. virtual ~W3DGameClient();
  63. /// given a type, create a drawable
  64. virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE );
  65. virtual void init( void ); ///< initialize resources
  66. virtual void update( void ); ///< per frame update
  67. virtual void reset( void ); ///< reset system
  68. virtual void addScorch(const Coord3D *pos, Real radius, Scorches type);
  69. virtual void createRayEffectByTemplate( const Coord3D *start, const Coord3D *end, const ThingTemplate* tmpl ); ///< create effect needing start and end location
  70. //virtual Bool getBonePos(Drawable *draw, AsciiString boneName, Coord3D* pos, Matrix3D* transform) const;
  71. virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now
  72. //---------------------------------------------------------------------------
  73. virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!!
  74. virtual void adjustLOD( Int adj ); ///< @todo hack for evaluation, remove.
  75. protected:
  76. virtual Keyboard *createKeyboard( void ); ///< factory for the keyboard
  77. virtual Mouse *createMouse( void ); ///< factory for the mouse
  78. /// factory for creating TheDisplay
  79. virtual Display *createGameDisplay( void ) { return NEW W3DDisplay; }
  80. /// factory for creating TheInGameUI
  81. virtual InGameUI *createInGameUI( void ) { return NEW W3DInGameUI; }
  82. /// factory for creating the window manager
  83. virtual GameWindowManager *createWindowManager( void ) { return NEW W3DGameWindowManager; }
  84. /// factory for creating the font library
  85. virtual FontLibrary *createFontLibrary( void ) { return NEW W3DFontLibrary; }
  86. /// Manager for display strings
  87. virtual DisplayStringManager *createDisplayStringManager( void ) { return NEW W3DDisplayStringManager; }
  88. virtual VideoPlayerInterface *createVideoPlayer( void ) { return NEW BinkVideoPlayer; }
  89. /// factory for creating the TerrainVisual
  90. virtual TerrainVisual *createTerrainVisual( void ) { return NEW W3DTerrainVisual; }
  91. virtual void setFrameRate(Real msecsPerFrame) { TheW3DFrameLengthInMsec = msecsPerFrame; }
  92. }; // end class W3DGameClient
  93. inline Keyboard *W3DGameClient::createKeyboard( void ) { return NEW DirectInputKeyboard; }
  94. inline Mouse *W3DGameClient::createMouse( void )
  95. {
  96. //return new DirectInputMouse;
  97. Win32Mouse * mouse = NEW W3DMouse;
  98. TheWin32Mouse = mouse; ///< global cheat for the WndProc()
  99. return mouse;
  100. }
  101. #endif // end __W3DGAMEINTERFACE_H_