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