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.

133 lines
4.1 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: TextSaver.h
  3. //
  4. // Desc: Fun screen saver
  5. //
  6. // Copyright (c) 2000 Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #ifndef _TEXTSAVER_H
  9. #define _TEXTSAVER_H
  10. //***************************************************************************************
  11. #define MAX_DISPLAY_STRING 20
  12. enum SurfType
  13. {
  14. color = 0,
  15. environment = 1,
  16. texture = 2
  17. };
  18. enum RotType
  19. {
  20. none = 0,
  21. spin = 1,
  22. seesaw = 2,
  23. wobble = 3,
  24. tumble = 4
  25. };
  26. //***************************************************************************************
  27. #define MAX_DEVICE_OBJECTS 10
  28. struct DeviceObjects
  29. {
  30. ID3DXMesh* m_pObject;
  31. IDirect3DTexture8* m_pTexture;
  32. DWORD m_dwMeshUpdateCounter;
  33. };
  34. //-----------------------------------------------------------------------------
  35. // Name: struct FLOATRECT
  36. // Desc: Floating viewport rect
  37. //-----------------------------------------------------------------------------
  38. struct FLOATRECT
  39. {
  40. FLOAT xMin;
  41. FLOAT yMin;
  42. FLOAT xSize;
  43. FLOAT ySize;
  44. FLOAT xVel;
  45. FLOAT yVel;
  46. };
  47. class CTextScreensaver : public CD3DScreensaver
  48. {
  49. public:
  50. CTextScreensaver();
  51. virtual VOID DoConfig();
  52. protected:
  53. // Overrides from CD3DScreensaver
  54. virtual HRESULT RegisterSoftwareDevice();
  55. virtual HRESULT FrameMove();
  56. virtual HRESULT Render();
  57. virtual HRESULT RestoreDeviceObjects();
  58. virtual HRESULT InvalidateDeviceObjects();
  59. virtual HRESULT ConfirmDevice(D3DCAPS8* pCaps, DWORD dwBehavior,
  60. D3DFORMAT fmtBackBuffer);
  61. virtual VOID SetDevice( UINT iDevice );
  62. DeviceObjects m_DeviceObjects[MAX_DEVICE_OBJECTS];
  63. DeviceObjects* m_pDeviceObjects;
  64. FLOATRECT m_floatrect;
  65. HFONT m_hFont;
  66. FLOAT m_fTextMinX,m_fTextMaxX;
  67. FLOAT m_fTextMinY,m_fTextMaxY;
  68. FLOAT m_fTextOffsetX,m_fTextOffsetY;
  69. FLOAT m_fAngleX,m_fAngleY,m_fAngleZ;
  70. DWORD m_dwLastTick;
  71. DWORD m_dwMeshUpdateCounter;
  72. IDirect3DTexture8* CreateTextureFromFile( const TCHAR* filename );
  73. HRESULT BuildTextMesh( const TCHAR* text );
  74. VOID UpdateAngles( DWORD elapsed );
  75. BOOL UpdateTimeString( TCHAR* string );
  76. VOID SetPerFrameStates();
  77. // Configuration stuff
  78. TCHAR m_szDisplayString[MAX_DISPLAY_STRING+1];
  79. LOGFONT m_Font;
  80. BOOL m_bDisplayTime;
  81. SurfType m_SurfType;
  82. BOOL m_bSpecular;
  83. DWORD m_dwRotationSpeed;
  84. DWORD m_dwSize;
  85. RotType m_RotType;
  86. COLORREF m_SurfaceColor;
  87. BOOL m_bUseCustomColor;
  88. BOOL m_bUseCustomTexture;
  89. BOOL m_bUseCustomEnvironment;
  90. TCHAR m_szCustomTexture[_MAX_PATH];
  91. TCHAR m_szCustomEnvironment[_MAX_PATH];
  92. DWORD m_dwMeshQuality;
  93. D3DXMATRIX m_matWorld;
  94. D3DXMATRIX m_matView;
  95. virtual VOID ReadSettings();
  96. VOID ss_ReadSettings();
  97. BOOL ss_RegistrySetup( int section, int file );
  98. int ss_GetRegistryInt( int name, int iDefault );
  99. VOID ss_GetRegistryString( int name, LPTSTR lpDefault, LPTSTR lpDest, int bufSize );
  100. static INT_PTR CALLBACK SettingsDialogProcStub( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam );
  101. BOOL SettingsDialogProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam );
  102. VOID InitItems( HWND hDlg );
  103. VOID ExtractAndWriteSettings( HWND hDlg );
  104. VOID SelectSurfaceColor( HWND hDlg );
  105. VOID SelectFont( HWND hDlg );
  106. VOID SelectCustomTexture( HWND hDlg );
  107. VOID SelectCustomEnvironment( HWND hDlg );
  108. VOID EnableTextureWindows( HWND hDlg , SurfType sel );
  109. };
  110. //***************************************************************************************
  111. #endif