Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
4.5 KiB

  1. /*****************************************************************************\
  2. FILE: main.h
  3. DESCRIPTION:
  4. Here we can subclass CDXScreenSaver if we want to override the behavior.
  5. BryanSt 12/24/2000
  6. Copyright (C) Microsoft Corp 2000-2001. All rights reserved.
  7. \*****************************************************************************/
  8. #ifndef SSMAIN_H
  9. #define SSMAIN_H
  10. extern IDirect3D8 * g_pD3D;
  11. extern DWORD g_dwWidth;
  12. extern DWORD g_dwHeight;
  13. extern BOOL g_fFirstFrame;
  14. class CMSLogoDXScreenSaver;
  15. extern CMSLogoDXScreenSaver * g_pScreenSaver;
  16. #include "texture.h"
  17. #include "d3dfont.h"
  18. #include "object.h"
  19. #include "util.h"
  20. #include "CameraMove.h"
  21. #include "room.h"
  22. #include "painting.h"
  23. #include "pictures.h"
  24. #include "config.h"
  25. #include "resource.h"
  26. class CCameraMove;
  27. #define ITEM_FLOOR 0
  28. #define ITEM_WALLPAPER 1
  29. #define ITEM_CEILING 2
  30. #define ITEM_TOEGUARD 3
  31. #define ITEM_RUG 4
  32. #define ITEM_FRAME 5
  33. #define ITEM_POWEROUTLET 6
  34. #define MAX_DEVICE_OBJECTS 10
  35. const LPCWSTR c_pszGlobalTextures[] =
  36. {
  37. L"Floor.bmp",
  38. L"Walls.bmp",
  39. L"Ceiling.bmp",
  40. L"ToeGuard.bmp",
  41. L"Rug.bmp",
  42. L"Frame.bmp",
  43. L"PowerSocket.bmp"
  44. };
  45. #ifdef MANUAL_CAMERA
  46. //-----------------------------------------------------------------------------
  47. // Name: struct Camera
  48. // Desc:
  49. //-----------------------------------------------------------------------------
  50. struct Camera
  51. {
  52. D3DXVECTOR3 m_vPosition;
  53. D3DXVECTOR3 m_vVelocity;
  54. FLOAT m_fYaw;
  55. FLOAT m_fYawVelocity;
  56. FLOAT m_fPitch;
  57. FLOAT m_fPitchVelocity;
  58. D3DXMATRIX m_matView;
  59. D3DXMATRIX m_matOrientation;
  60. };
  61. #endif
  62. struct DeviceObjects
  63. {
  64. CD3DFont* m_pStatsFont;
  65. };
  66. class CMSLogoDXScreenSaver : public CD3DScreensaver
  67. {
  68. public:
  69. virtual void DoConfig(void);
  70. CTexture * GetGlobalTexture(DWORD dwItem, float * pfScale);
  71. IDirect3DDevice8 * GetD3DDevice(void);
  72. virtual void SetDevice(UINT iDevice);
  73. virtual HRESULT ConfirmDevice(D3DCAPS8 * pCaps, DWORD dwBehavior, D3DFORMAT fmtBackBuffer);
  74. void DisplayMonitorSettings(HWND hwndParent) {DoScreenSettingsDialog(hwndParent);}
  75. virtual VOID ReadSettings();
  76. HRESULT GetCurrentScreenSize(int * pnWidth, int * pnHeight);
  77. int GetNumberOfMonitors(void) {return m_dwNumAdapters;}
  78. int GetCurrMonitorIndex(void) {return m_nCurrentDevice;}
  79. VOID ReadScreenSettingsPublic( HKEY hkey ) { ReadScreenSettings( hkey ); }
  80. VOID WriteScreenSettingsPublic( HKEY hkey ) { WriteScreenSettings( hkey ); }
  81. CULLINFO* PCullInfo(void) { return &m_cullInfo; }
  82. BOOL UseSmallImages(void) {return m_fUseSmallImages;}
  83. CMSLogoDXScreenSaver();
  84. virtual ~CMSLogoDXScreenSaver();
  85. protected:
  86. // Member Functions
  87. virtual HRESULT RegisterSoftwareDevice(void);
  88. virtual HRESULT OneTimeSceneInit(void) {return S_OK;}
  89. virtual HRESULT FrameMove(void);
  90. virtual HRESULT Render(void);
  91. virtual HRESULT DeleteDeviceObjects(void);
  92. virtual HRESULT FinalCleanup(void);
  93. virtual HRESULT InitDeviceObjects(void);
  94. virtual HRESULT RestoreDeviceObjects();
  95. virtual HRESULT InvalidateDeviceObjects();
  96. virtual BOOL UseLowResolution(int * pRecommendX, int * pRecommendY);
  97. #ifdef MANUAL_CAMERA
  98. VOID UpdateCamera(Camera* pCamera);
  99. virtual LRESULT SaverProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  100. #endif
  101. private:
  102. // Helper Functions
  103. HRESULT SetViewParams(IDirect3DDevice8 * pD3DDevice, D3DXVECTOR3 * pvecEyePt, D3DXVECTOR3 * pvecLookatPt, D3DXVECTOR3 * pvecUpVec, float nNumber);
  104. HRESULT _Init(void);
  105. HRESULT _SetTestCameraPosition(void);
  106. HRESULT _OneTimeSceneInit(void);
  107. HRESULT _CheckMachinePerf(void);
  108. // Member Variables
  109. CTheRoom * m_pCurrentRoom;
  110. BOOL m_fFrontToBack;
  111. int m_nCurrentDevice;
  112. BOOL m_fShowFrameInfo;
  113. CULLINFO m_cullInfo;
  114. BOOL m_fUseSmallImages; // If TRUE, Cap images at 512x512, otherwise 1024x1024
  115. #ifdef MANUAL_CAMERA
  116. BYTE m_bKey[256];
  117. Camera m_camera;
  118. #endif
  119. CCameraMove * m_ptheCamera;
  120. DeviceObjects m_DeviceObjects[MAX_DEVICE_OBJECTS];
  121. DeviceObjects * m_pDeviceObjects;
  122. CTexture * m_pTextures[ARRAYSIZE(c_pszGlobalTextures)];
  123. FLOAT m_fTimeKeyIn;
  124. };
  125. #endif // SSMAIN_H