DXUTSettingsDlg.h
上传用户:junlon
上传日期:2022-01-05
资源大小:39075k
文件大小:5k
源码类别:

DirextX编程

开发平台:

Visual C++

  1. //--------------------------------------------------------------------------------------
  2. // File: DXUTSettingsDlg.cpp
  3. //
  4. // Copyright (c) Microsoft Corporation. All rights reserved
  5. //--------------------------------------------------------------------------------------
  6. #pragma once
  7. #ifndef DXUT_SETTINGS_H
  8. #define DXUT_SETTINGS_H
  9. //--------------------------------------------------------------------------------------
  10. // Control IDs
  11. //--------------------------------------------------------------------------------------
  12. #define DXUTSETTINGSDLG_STATIC                  -1
  13. #define DXUTSETTINGSDLG_OK                      1
  14. #define DXUTSETTINGSDLG_CANCEL                  2
  15. #define DXUTSETTINGSDLG_ADAPTER                 3
  16. #define DXUTSETTINGSDLG_DEVICE_TYPE             4
  17. #define DXUTSETTINGSDLG_WINDOWED                5
  18. #define DXUTSETTINGSDLG_FULLSCREEN              6
  19. #define DXUTSETTINGSDLG_ADAPTER_FORMAT          7
  20. #define DXUTSETTINGSDLG_ADAPTER_FORMAT_LABEL    8
  21. #define DXUTSETTINGSDLG_RESOLUTION              9
  22. #define DXUTSETTINGSDLG_RESOLUTION_LABEL        10
  23. #define DXUTSETTINGSDLG_REFRESH_RATE            11
  24. #define DXUTSETTINGSDLG_REFRESH_RATE_LABEL      12
  25. #define DXUTSETTINGSDLG_BACK_BUFFER_FORMAT      13
  26. #define DXUTSETTINGSDLG_DEPTH_STENCIL           14
  27. #define DXUTSETTINGSDLG_MULTISAMPLE_TYPE        15
  28. #define DXUTSETTINGSDLG_MULTISAMPLE_QUALITY     16
  29. #define DXUTSETTINGSDLG_VERTEX_PROCESSING       17
  30. #define DXUTSETTINGSDLG_PRESENT_INTERVAL        18
  31. #define DXUTSETTINGSDLG_DEVICECLIP              19
  32. #define DXUTSETTINGSDLG_RESOLUTION_SHOW_ALL     20
  33. #define DXUTSETTINGSDLG_WINDOWED_GROUP          0x0100
  34. //--------------------------------------------------------------------------------------
  35. // Dialog for selection of device settings 
  36. // Use DXUTGetSettingsDialog() to access global instance
  37. // To control the contents of the dialog, use the CD3DEnumeration class.
  38. //--------------------------------------------------------------------------------------
  39. class CD3DSettingsDlg
  40. {
  41. public:
  42.     CD3DSettingsDlg();
  43.     ~CD3DSettingsDlg();
  44.     void Init( CDXUTDialogResourceManager* pManager );
  45.     void Init( CDXUTDialogResourceManager* pManager, LPCWSTR szControlTextureFileName );
  46. void Init( CDXUTDialogResourceManager* pManager, LPCWSTR pszControlTextureResourcename, HMODULE hModule);
  47.     HRESULT OnCreateDevice( IDirect3DDevice9* pd3dDevice );
  48.     HRESULT Refresh();
  49.     HRESULT OnResetDevice();
  50.     HRESULT OnLostDevice();
  51.     HRESULT OnRender( float fElapsedTime );
  52.     HRESULT OnDestroyDevice();
  53.     CDXUTDialog* GetDialogControl() { return &m_Dialog; }
  54.     bool IsActive() { return m_bActive; }
  55.     void SetActive( bool bActive ) { m_bActive = bActive; if( bActive ) Refresh(); }
  56.     LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  57. protected:
  58.     friend CD3DSettingsDlg* DXUTGetSettingsDialog();
  59.     void CreateControls();
  60.     HRESULT SetDeviceSettingsFromUI();
  61.     void OnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl );
  62.     static void WINAPI StaticOnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserData );
  63.     CD3DEnumAdapterInfo* GetCurrentAdapterInfo();
  64.     CD3DEnumDeviceInfo* GetCurrentDeviceInfo();
  65.     CD3DEnumDeviceSettingsCombo* GetCurrentDeviceSettingsCombo();
  66.     void AddAdapter( const WCHAR* strDescription, UINT iAdapter );
  67.     UINT GetSelectedAdapter();
  68.     void AddDeviceType( D3DDEVTYPE devType );
  69.     D3DDEVTYPE GetSelectedDeviceType();
  70.     void SetWindowed( bool bWindowed );
  71.     bool IsWindowed();
  72.     void AddAdapterFormat( D3DFORMAT format );
  73.     D3DFORMAT GetSelectedAdapterFormat();
  74.     void AddResolution( DWORD dwWidth, DWORD dwHeight );
  75.     void GetSelectedResolution( DWORD* pdwWidth, DWORD* pdwHeight );
  76.     void AddRefreshRate( DWORD dwRate );
  77.     DWORD GetSelectedRefreshRate();
  78.     void AddBackBufferFormat( D3DFORMAT format );
  79.     D3DFORMAT GetSelectedBackBufferFormat();
  80.     void AddDepthStencilBufferFormat( D3DFORMAT format );
  81.     D3DFORMAT GetSelectedDepthStencilBufferFormat();
  82.     void AddMultisampleType( D3DMULTISAMPLE_TYPE type );
  83.     D3DMULTISAMPLE_TYPE GetSelectedMultisampleType();
  84.     void AddMultisampleQuality( DWORD dwQuality );
  85.     DWORD GetSelectedMultisampleQuality();
  86.     void AddVertexProcessingType( DWORD dwType );
  87.     DWORD GetSelectedVertexProcessingType();
  88.     DWORD GetSelectedPresentInterval();
  89.     void SetDeviceClip( bool bDeviceClip );
  90.     bool IsDeviceClip();
  91.     HRESULT OnAdapterChanged();
  92.     HRESULT OnDeviceTypeChanged();
  93.     HRESULT OnWindowedFullScreenChanged();
  94.     HRESULT OnAdapterFormatChanged();
  95.     HRESULT OnResolutionChanged();
  96.     HRESULT OnRefreshRateChanged();
  97.     HRESULT OnBackBufferFormatChanged();
  98.     HRESULT OnDepthStencilBufferFormatChanged();
  99.     HRESULT OnMultisampleTypeChanged();
  100.     HRESULT OnMultisampleQualityChanged();
  101.     HRESULT OnVertexProcessingChanged();
  102.     HRESULT OnPresentIntervalChanged();
  103.     HRESULT OnDeviceClipChanged();
  104.     IDirect3DStateBlock9* m_pStateBlock;
  105.     CDXUTDialog m_Dialog;
  106.     bool m_bActive; 
  107. };
  108. CD3DSettingsDlg* DXUTGetSettingsDialog();
  109. #endif