Source code of Windows XP (NT5)
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.

83 lines
2.2 KiB

  1. #ifndef _SWOOSH_H
  2. #define _SWOOSH_H
  3. //**********************************************************************************
  4. #include <windows.h>
  5. #include <d3d8.h>
  6. #include <d3d8rgbrast.h>
  7. #include <d3dx8.h>
  8. #include <d3dsaver.h>
  9. //**********************************************************************************
  10. class CSwoosh : public CD3DScreensaver
  11. {
  12. public:
  13. CSwoosh();
  14. virtual HRESULT Create( HINSTANCE hInstance );
  15. protected:
  16. // Key stuff to override from CD3DScreensaver
  17. virtual HRESULT RegisterSoftwareDevice();
  18. virtual void SetDevice( UINT iDevice );
  19. virtual HRESULT Render();
  20. virtual HRESULT FrameMove();
  21. virtual HRESULT RestoreDeviceObjects();
  22. virtual HRESULT InvalidateDeviceObjects();
  23. virtual void ReadSettings();
  24. virtual void DoConfig();
  25. // All the settings for the screensaver
  26. DWORD m_dwNumParticles;
  27. DWORD m_dwColourMix;
  28. DWORD m_dwColour1;
  29. DWORD m_dwColour2;
  30. DWORD m_dwFixedColour1;
  31. DWORD m_dwFixedColour2;
  32. float m_fFlowRate;
  33. float m_fRollRate;
  34. float m_fYawRate;
  35. float m_fParticleSize;
  36. // Stuff we need to keep track of on a per-device basis (textures, whathaveyou)
  37. // We update the m_pDeviceObjects pointer in SetDevice to point to the current set
  38. struct DeviceObjects
  39. {
  40. DeviceObjects();
  41. IDirect3DTexture8* pBlobTexture;
  42. IDirect3DVertexBuffer8* pParticleVB;
  43. IDirect3DIndexBuffer8* pParticleIB;
  44. };
  45. enum { MAX_DEVICE_OBJECTS = 10 };
  46. DeviceObjects m_DeviceObjects[MAX_DEVICE_OBJECTS];
  47. DeviceObjects* m_pDeviceObjects;
  48. DWORD m_dwVertMemType;
  49. struct Particle
  50. {
  51. D3DXVECTOR3 pos;
  52. D3DCOLOR colour;
  53. };
  54. enum { MAX_PARTICLES = 8192 };
  55. Particle m_Particles[MAX_PARTICLES];
  56. D3DXMATRIX m_Camera;
  57. void InitParticles();
  58. void UpdateParticles();
  59. void RenderParticles();
  60. void UpdateCamera();
  61. void WriteSettings();
  62. float m_fCameraYaw,m_fCameraRoll;
  63. float m_fYawDirection;
  64. float m_fYawPause;
  65. static BOOL CALLBACK ConfigDlgProcStub( HWND hDlg , UINT msg , WPARAM wParam , LPARAM lParam );
  66. BOOL ConfigDlgProc( HWND hDlg , UINT msg , WPARAM wParam , LPARAM lParam );
  67. void ExtractDialogSettings( HWND hDlg );
  68. DWORD PickColour( HWND hParent , DWORD defcolour );
  69. };
  70. //**********************************************************************************
  71. #endif