d3dsettings.cpp
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:39k
源码类别:

游戏

开发平台:

Visual C++

  1. //-----------------------------------------------------------------------------
  2. // File: D3DSettings.cpp
  3. //
  4. // Desc: Settings class and change-settings dialog class for the Direct3D 
  5. //       samples framework library.
  6. //
  7. // Copyright (c) Microsoft Corporation. All rights reserved.
  8. //-----------------------------------------------------------------------------
  9. #include "dxstdafx.h"
  10. CD3DSettingsDialog* s_pSettingsDialog = NULL;
  11. //-----------------------------------------------------------------------------
  12. // Name: D3DDevTypeToString
  13. // Desc: Returns the string for the given D3DDEVTYPE.
  14. //-----------------------------------------------------------------------------
  15. TCHAR* D3DDevTypeToString(D3DDEVTYPE devType)
  16. {
  17.     switch (devType)
  18.     {
  19.     case D3DDEVTYPE_HAL:        return TEXT("D3DDEVTYPE_HAL");
  20.     case D3DDEVTYPE_SW:         return TEXT("D3DDEVTYPE_SW");
  21.     case D3DDEVTYPE_REF:        return TEXT("D3DDEVTYPE_REF");
  22.     default:                    return TEXT("Unknown devType");
  23.     }
  24. }
  25. //-----------------------------------------------------------------------------
  26. // Name: MultisampleTypeToString
  27. // Desc: Returns the string for the given D3DMULTISAMPLE_TYPE.
  28. //-----------------------------------------------------------------------------
  29. TCHAR* MultisampleTypeToString(D3DMULTISAMPLE_TYPE MultiSampleType)
  30. {
  31.     switch (MultiSampleType)
  32.     {
  33.     case D3DMULTISAMPLE_NONE:   return TEXT("D3DMULTISAMPLE_NONE");
  34.     case D3DMULTISAMPLE_NONMASKABLE: return TEXT("D3DMULTISAMPLE_NONMASKABLE");
  35.     case D3DMULTISAMPLE_2_SAMPLES: return TEXT("D3DMULTISAMPLE_2_SAMPLES");
  36.     case D3DMULTISAMPLE_3_SAMPLES: return TEXT("D3DMULTISAMPLE_3_SAMPLES");
  37.     case D3DMULTISAMPLE_4_SAMPLES: return TEXT("D3DMULTISAMPLE_4_SAMPLES");
  38.     case D3DMULTISAMPLE_5_SAMPLES: return TEXT("D3DMULTISAMPLE_5_SAMPLES");
  39.     case D3DMULTISAMPLE_6_SAMPLES: return TEXT("D3DMULTISAMPLE_6_SAMPLES");
  40.     case D3DMULTISAMPLE_7_SAMPLES: return TEXT("D3DMULTISAMPLE_7_SAMPLES");
  41.     case D3DMULTISAMPLE_8_SAMPLES: return TEXT("D3DMULTISAMPLE_8_SAMPLES");
  42.     case D3DMULTISAMPLE_9_SAMPLES: return TEXT("D3DMULTISAMPLE_9_SAMPLES");
  43.     case D3DMULTISAMPLE_10_SAMPLES: return TEXT("D3DMULTISAMPLE_10_SAMPLES");
  44.     case D3DMULTISAMPLE_11_SAMPLES: return TEXT("D3DMULTISAMPLE_11_SAMPLES");
  45.     case D3DMULTISAMPLE_12_SAMPLES: return TEXT("D3DMULTISAMPLE_12_SAMPLES");
  46.     case D3DMULTISAMPLE_13_SAMPLES: return TEXT("D3DMULTISAMPLE_13_SAMPLES");
  47.     case D3DMULTISAMPLE_14_SAMPLES: return TEXT("D3DMULTISAMPLE_14_SAMPLES");
  48.     case D3DMULTISAMPLE_15_SAMPLES: return TEXT("D3DMULTISAMPLE_15_SAMPLES");
  49.     case D3DMULTISAMPLE_16_SAMPLES: return TEXT("D3DMULTISAMPLE_16_SAMPLES");
  50.     default:                    return TEXT("Unknown Multisample Type");
  51.     }
  52. }
  53. //-----------------------------------------------------------------------------
  54. // Name: VertexProcessingTypeToString
  55. // Desc: Returns the string for the given VertexProcessingType.
  56. //-----------------------------------------------------------------------------
  57. TCHAR* VertexProcessingTypeToString(VertexProcessingType vpt)
  58. {
  59.     switch (vpt)
  60.     {
  61.     case SOFTWARE_VP:      return TEXT("SOFTWARE_VP");
  62.     case MIXED_VP:         return TEXT("MIXED_VP");
  63.     case HARDWARE_VP:      return TEXT("HARDWARE_VP");
  64.     case PURE_HARDWARE_VP: return TEXT("PURE_HARDWARE_VP");
  65.     default:               return TEXT("Unknown VertexProcessingType");
  66.     }
  67. }
  68. //-----------------------------------------------------------------------------
  69. // Name: PresentIntervalToString
  70. // Desc: Returns the string for the given present interval.
  71. //-----------------------------------------------------------------------------
  72. TCHAR* PresentIntervalToString( UINT pi )
  73. {
  74.     switch( pi )
  75.     {
  76.     case D3DPRESENT_INTERVAL_IMMEDIATE: return TEXT("D3DPRESENT_INTERVAL_IMMEDIATE");
  77.     case D3DPRESENT_INTERVAL_DEFAULT:   return TEXT("D3DPRESENT_INTERVAL_DEFAULT");
  78.     case D3DPRESENT_INTERVAL_ONE:       return TEXT("D3DPRESENT_INTERVAL_ONE");
  79.     case D3DPRESENT_INTERVAL_TWO:       return TEXT("D3DPRESENT_INTERVAL_TWO");
  80.     case D3DPRESENT_INTERVAL_THREE:     return TEXT("D3DPRESENT_INTERVAL_THREE");
  81.     case D3DPRESENT_INTERVAL_FOUR:      return TEXT("D3DPRESENT_INTERVAL_FOUR");
  82.     default:                            return TEXT("Unknown PresentInterval");
  83.     }
  84. }
  85. //-----------------------------------------------------------------------------
  86. // Name: DialogProcHelper
  87. // Desc: 
  88. //-----------------------------------------------------------------------------
  89. INT_PTR CALLBACK DialogProcHelper( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  90. {
  91.     return s_pSettingsDialog->DialogProc( hDlg, msg, wParam, lParam );
  92. }
  93. //-----------------------------------------------------------------------------
  94. // Name: CD3DSettingsDialog constructor
  95. // Desc: 
  96. //-----------------------------------------------------------------------------
  97. CD3DSettingsDialog::CD3DSettingsDialog( CD3DEnumeration* pEnumeration, 
  98.                                         CD3DSettings* pSettings)
  99. {
  100.     s_pSettingsDialog = this;
  101.     m_pEnumeration = pEnumeration;
  102.     m_d3dSettings = *pSettings;
  103. }
  104. //-----------------------------------------------------------------------------
  105. // Name: ComboBoxAdd
  106. // Desc: Adds an entry to the combo box.
  107. //-----------------------------------------------------------------------------
  108. void CD3DSettingsDialog::ComboBoxAdd( int id, void* pData, LPCTSTR pstrDesc )
  109. {
  110.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  111.     DWORD dwItem = ComboBox_AddString( hwndCtrl, pstrDesc );
  112.     ComboBox_SetItemData( hwndCtrl, dwItem, pData );
  113. }
  114. //-----------------------------------------------------------------------------
  115. // Name: ComboBoxSelect
  116. // Desc: Selects an entry in the combo box.
  117. //-----------------------------------------------------------------------------
  118. void CD3DSettingsDialog::ComboBoxSelect( int id, void* pData )
  119. {
  120.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  121.     UINT count = ComboBoxCount( id );
  122.     for( UINT iItem = 0; iItem < count; iItem++ )
  123.     {
  124.         if( (void*)ComboBox_GetItemData( hwndCtrl, iItem ) == pData )
  125.         {
  126.             ComboBox_SetCurSel( hwndCtrl, iItem );
  127.             PostMessage( m_hDlg, WM_COMMAND, 
  128.                 MAKEWPARAM( id, CBN_SELCHANGE ), (LPARAM)hwndCtrl );
  129.             return;
  130.         }
  131.     }
  132. }
  133. //-----------------------------------------------------------------------------
  134. // Name: ComboBoxSelectIndex
  135. // Desc: Selects an entry in the combo box.
  136. //-----------------------------------------------------------------------------
  137. void CD3DSettingsDialog::ComboBoxSelectIndex( int id, int index )
  138. {
  139.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  140.     ComboBox_SetCurSel( hwndCtrl, index );
  141.     PostMessage( m_hDlg, WM_COMMAND, MAKEWPARAM( id, CBN_SELCHANGE ), 
  142.         (LPARAM)hwndCtrl );
  143. }
  144. //-----------------------------------------------------------------------------
  145. // Name: ComboBoxSelected
  146. // Desc: Returns the data for the selected entry in the combo box.
  147. //-----------------------------------------------------------------------------
  148. void* CD3DSettingsDialog::ComboBoxSelected( int id )
  149. {
  150.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  151.     int index = ComboBox_GetCurSel( hwndCtrl );
  152.     if( index < 0 )
  153.         return NULL;
  154.     return (void*)ComboBox_GetItemData( hwndCtrl, index );
  155. }
  156. //-----------------------------------------------------------------------------
  157. // Name: ComboBoxSomethingSelected
  158. // Desc: Returns whether any entry in the combo box is selected.  This is 
  159. //       more useful than ComboBoxSelected() when you need to distinguish 
  160. //       between having no item selected vs. having an item selected whose 
  161. //       itemData is NULL.
  162. //-----------------------------------------------------------------------------
  163. bool CD3DSettingsDialog::ComboBoxSomethingSelected( int id )
  164. {
  165.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  166.     int index = ComboBox_GetCurSel( hwndCtrl );
  167.     return ( index >= 0 );
  168. }
  169. //-----------------------------------------------------------------------------
  170. // Name: ComboBoxCount
  171. // Desc: Returns the number of entries in the combo box.
  172. //-----------------------------------------------------------------------------
  173. UINT CD3DSettingsDialog::ComboBoxCount( int id )
  174. {
  175.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  176.     return ComboBox_GetCount( hwndCtrl );
  177. }
  178. //-----------------------------------------------------------------------------
  179. // Name: ComboBoxClear
  180. // Desc: Clears the entries in the combo box.
  181. //-----------------------------------------------------------------------------
  182. void CD3DSettingsDialog::ComboBoxClear( int id )
  183. {
  184.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  185.     ComboBox_ResetContent( hwndCtrl );
  186. }
  187. //-----------------------------------------------------------------------------
  188. // Name: ComboBoxContainsText
  189. // Desc: Returns whether the combo box contains the given text.
  190. //-----------------------------------------------------------------------------
  191. bool CD3DSettingsDialog::ComboBoxContainsText( int id, LPCTSTR pstrText )
  192. {
  193.     TCHAR strItem[200];
  194.     HWND hwndCtrl = GetDlgItem( m_hDlg, id );
  195.     UINT count = ComboBoxCount( id );
  196.     for( UINT iItem = 0; iItem < count; iItem++ )
  197.     {
  198.         if( ComboBox_GetLBTextLen( hwndCtrl, iItem ) >= 200 )
  199.             continue; // shouldn't happen, but don't overwrite buffer if it does
  200.         ComboBox_GetLBText( hwndCtrl, iItem, strItem );
  201.         if( lstrcmp( strItem, pstrText ) == 0 )
  202.             return true;
  203.     }
  204.     return false;
  205. }
  206. //-----------------------------------------------------------------------------
  207. // Name: ShowDialog
  208. // Desc: Show the D3D settings dialog.
  209. //-----------------------------------------------------------------------------
  210. INT_PTR CD3DSettingsDialog::ShowDialog( HWND hwndParent )
  211. {
  212.     return DialogBox( NULL, MAKEINTRESOURCE( IDD_SELECTDEVICE ), 
  213.         hwndParent, DialogProcHelper );
  214. }
  215. //-----------------------------------------------------------------------------
  216. // Name: DialogProc
  217. // Desc: Handle window messages in the dialog.
  218. //-----------------------------------------------------------------------------
  219. INT_PTR CD3DSettingsDialog::DialogProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  220. {
  221.     UNREFERENCED_PARAMETER( lParam );
  222.     switch( msg )
  223.     {
  224.     case WM_INITDIALOG:
  225.         {
  226.             m_hDlg = hDlg;
  227.             // Fill adapter combo box.  Updating the selected adapter will trigger
  228.             // updates of the rest of the dialog.
  229.             for( UINT iai = 0; iai < m_pEnumeration->m_pAdapterInfoList->Count(); iai++ )
  230.             {
  231.                 D3DAdapterInfo* pAdapterInfo;
  232.                 pAdapterInfo = (D3DAdapterInfo*)m_pEnumeration->m_pAdapterInfoList->GetPtr(iai);
  233.                 TCHAR strDescription[512];
  234.                 DXUtil_ConvertAnsiStringToGenericCch( strDescription, pAdapterInfo->AdapterIdentifier.Description, 512 );
  235.                 ComboBoxAdd( IDC_ADAPTER_COMBO, pAdapterInfo, strDescription );
  236.                 if( pAdapterInfo->AdapterOrdinal == m_d3dSettings.AdapterOrdinal() )
  237.                     ComboBoxSelect( IDC_ADAPTER_COMBO, pAdapterInfo );
  238.             }
  239.             if( !ComboBoxSomethingSelected( IDC_ADAPTER_COMBO ) &&
  240.                 ComboBoxCount( IDC_ADAPTER_COMBO ) > 0 )
  241.             {
  242.                 ComboBoxSelectIndex( IDC_ADAPTER_COMBO, 0 );
  243.             }
  244.         }
  245.         return TRUE;
  246.     case WM_COMMAND:
  247.         switch( LOWORD(wParam) )
  248.         {
  249.         case IDOK:
  250.             EndDialog( hDlg, IDOK );
  251.             break;
  252.         case IDCANCEL:
  253.             EndDialog( hDlg, IDCANCEL );
  254.             break;
  255.         case IDC_ADAPTER_COMBO:
  256.             if( CBN_SELCHANGE == HIWORD(wParam) )
  257.                 AdapterChanged();
  258.             break;
  259.         case IDC_DEVICE_COMBO:
  260.             if( CBN_SELCHANGE == HIWORD(wParam) )
  261.                 DeviceChanged();
  262.             break;
  263.         case IDC_ADAPTERFORMAT_COMBO:
  264.             if( CBN_SELCHANGE == HIWORD(wParam) )
  265.                 AdapterFormatChanged();
  266.             break;
  267.         case IDC_RESOLUTION_COMBO:
  268.             if( CBN_SELCHANGE == HIWORD(wParam) )
  269.                 ResolutionChanged();
  270.             break;
  271.         case IDC_REFRESHRATE_COMBO:
  272.             if( CBN_SELCHANGE == HIWORD(wParam) )
  273.                 RefreshRateChanged();
  274.             break;
  275.         case IDC_BACKBUFFERFORMAT_COMBO:
  276.             if( CBN_SELCHANGE == HIWORD(wParam) )
  277.                 BackBufferFormatChanged();
  278.             break;
  279.         case IDC_DEPTHSTENCILBUFFERFORMAT_COMBO:
  280.             if( CBN_SELCHANGE == HIWORD(wParam) )
  281.                 DepthStencilBufferFormatChanged();
  282.             break;
  283.         case IDC_MULTISAMPLE_COMBO:
  284.             if( CBN_SELCHANGE == HIWORD(wParam) )
  285.                 MultisampleTypeChanged();
  286.             break;
  287.         case IDC_MULTISAMPLE_QUALITY_COMBO:
  288.             if( CBN_SELCHANGE == HIWORD(wParam) )
  289.                 MultisampleQualityChanged();
  290.             break;
  291.         case IDC_VERTEXPROCESSING_COMBO:
  292.             if( CBN_SELCHANGE == HIWORD(wParam) )
  293.                 VertexProcessingChanged();
  294.             break;
  295.         case IDC_PRESENTINTERVAL_COMBO:
  296.             if( CBN_SELCHANGE == HIWORD(wParam) )
  297.                 PresentIntervalChanged();
  298.             break;
  299.         case IDC_DEVICECLIP_CHECK:
  300.             if( BN_CLICKED == HIWORD(wParam) )
  301.                 DeviceClipChanged();
  302.             break;
  303.         case IDC_WINDOW:
  304.         case IDC_FULLSCREEN:
  305.             WindowedFullscreenChanged();
  306.             break;
  307.         }
  308.         return TRUE;
  309.     default:
  310.         return FALSE;
  311.     }
  312. }
  313. //-----------------------------------------------------------------------------
  314. // Name: AdapterChanged
  315. // Desc: Respond to a change of selected adapter.
  316. //-----------------------------------------------------------------------------
  317. void CD3DSettingsDialog::AdapterChanged( void )
  318. {
  319.     D3DAdapterInfo* pAdapterInfo = (D3DAdapterInfo*)ComboBoxSelected( IDC_ADAPTER_COMBO );
  320.     if( pAdapterInfo == NULL )
  321.         return;
  322.     
  323.     if( m_d3dSettings.IsWindowed )
  324.     {
  325.         m_d3dSettings.pWindowed_AdapterInfo = pAdapterInfo;
  326.         // Set the windowed display mode format to what the
  327.         // adapter is currently in.
  328.         IDirect3D9* pD3D = m_pEnumeration->GetD3D();
  329.         if( pD3D )
  330.         {
  331.             D3DDISPLAYMODE Mode;
  332.             if( SUCCEEDED( pD3D->GetAdapterDisplayMode( pAdapterInfo->AdapterOrdinal, &Mode ) ) )
  333.                 m_d3dSettings.Windowed_DisplayMode.Format = Mode.Format;
  334.             SAFE_RELEASE( pD3D );
  335.         }
  336.     }
  337.     else
  338.         m_d3dSettings.pFullscreen_AdapterInfo = pAdapterInfo;
  339.     // Update device combo box
  340.     ComboBoxClear( IDC_DEVICE_COMBO );
  341.     for( UINT idi = 0; idi < pAdapterInfo->pDeviceInfoList->Count(); idi++ )
  342.     {
  343.         D3DDeviceInfo* pDeviceInfo = (D3DDeviceInfo*)pAdapterInfo->pDeviceInfoList->GetPtr(idi);
  344.         ComboBoxAdd( IDC_DEVICE_COMBO, pDeviceInfo, 
  345.                      D3DDevTypeToString( pDeviceInfo->DevType ) );
  346.         if( pDeviceInfo->DevType == m_d3dSettings.DevType() )
  347.             ComboBoxSelect( IDC_DEVICE_COMBO, pDeviceInfo );
  348.     }
  349.     if( !ComboBoxSomethingSelected( IDC_DEVICE_COMBO ) &&
  350.         ComboBoxCount( IDC_DEVICE_COMBO ) > 0 )
  351.     {
  352.         ComboBoxSelectIndex( IDC_DEVICE_COMBO, 0 );
  353.     }
  354. }
  355. //-----------------------------------------------------------------------------
  356. // Name: DeviceChanged
  357. // Desc: Respond to a change of selected device by resetting the 
  358. //       fullscreen/windowed radio buttons.  Updating these buttons will 
  359. //       trigger updates of the rest of the dialog.
  360. //-----------------------------------------------------------------------------
  361. void CD3DSettingsDialog::DeviceChanged( void )
  362. {
  363.     D3DDeviceInfo* pDeviceInfo = (D3DDeviceInfo*)ComboBoxSelected( IDC_DEVICE_COMBO );
  364.     if( pDeviceInfo == NULL )
  365.         return;
  366.     if( m_d3dSettings.IsWindowed )
  367.         m_d3dSettings.pWindowed_DeviceInfo = pDeviceInfo;
  368.     else
  369.         m_d3dSettings.pFullscreen_DeviceInfo = pDeviceInfo;
  370.     // Update fullscreen/windowed radio buttons
  371.     bool HasWindowedDeviceCombo = false;
  372.     bool HasFullscreenDeviceCombo = false;
  373.     for( UINT idc = 0; idc < pDeviceInfo->pDeviceComboList->Count(); idc++ )
  374.     {
  375.         D3DDeviceCombo* pDeviceCombo = (D3DDeviceCombo*)pDeviceInfo->pDeviceComboList->GetPtr(idc);
  376.         if( pDeviceCombo->IsWindowed )
  377.             HasWindowedDeviceCombo = true;
  378.         else
  379.             HasFullscreenDeviceCombo = true;
  380.     }
  381.     EnableWindow( GetDlgItem( m_hDlg, IDC_WINDOW ), HasWindowedDeviceCombo );
  382.     EnableWindow( GetDlgItem( m_hDlg, IDC_FULLSCREEN ), HasFullscreenDeviceCombo );
  383.     if (m_d3dSettings.IsWindowed && HasWindowedDeviceCombo)
  384.     {
  385.         CheckRadioButton( m_hDlg, IDC_WINDOW, IDC_FULLSCREEN, IDC_WINDOW );
  386.     }
  387.     else
  388.     {
  389.         CheckRadioButton( m_hDlg, IDC_WINDOW, IDC_FULLSCREEN, IDC_FULLSCREEN );
  390.     }
  391.     WindowedFullscreenChanged();
  392. }
  393. //-----------------------------------------------------------------------------
  394. // Name: WindowedFullscreenChanged
  395. // Desc: Respond to a change of windowed/fullscreen state by rebuilding the
  396. //       adapter format list, resolution list, and refresh rate list.
  397. //       Updating the selected adapter format will trigger updates of the 
  398. //       rest of the dialog.
  399. //-----------------------------------------------------------------------------
  400. void CD3DSettingsDialog::WindowedFullscreenChanged( void )
  401. {
  402.     D3DAdapterInfo* pAdapterInfo = (D3DAdapterInfo*)ComboBoxSelected( IDC_ADAPTER_COMBO );
  403.     D3DDeviceInfo* pDeviceInfo = (D3DDeviceInfo*)ComboBoxSelected( IDC_DEVICE_COMBO );
  404.     if( pAdapterInfo == NULL || pDeviceInfo == NULL )
  405.         return;
  406.     if( IsDlgButtonChecked( m_hDlg, IDC_WINDOW ) )
  407.     {
  408.         m_d3dSettings.IsWindowed = true;
  409.         m_d3dSettings.pWindowed_AdapterInfo = pAdapterInfo;
  410.         m_d3dSettings.pWindowed_DeviceInfo = pDeviceInfo;
  411.         // Update device clip check box
  412.         EnableWindow( GetDlgItem( m_hDlg, IDC_DEVICECLIP_CHECK ), true );
  413.         if( m_d3dSettings.DeviceClip() )
  414.             SendMessage( GetDlgItem( m_hDlg, IDC_DEVICECLIP_CHECK ), BM_SETCHECK, BST_CHECKED, 0 );
  415.         else
  416.             SendMessage( GetDlgItem( m_hDlg, IDC_DEVICECLIP_CHECK ), BM_SETCHECK, BST_UNCHECKED, 0 );
  417.         // Update adapter format combo box
  418.         ComboBoxClear( IDC_ADAPTERFORMAT_COMBO );
  419.         ComboBoxAdd( IDC_ADAPTERFORMAT_COMBO, (void*)m_d3dSettings.Windowed_DisplayMode.Format,
  420.             D3DUtil_D3DFormatToString( m_d3dSettings.Windowed_DisplayMode.Format ) );
  421.         ComboBoxSelectIndex( IDC_ADAPTERFORMAT_COMBO, 0 );
  422.         EnableWindow( GetDlgItem( m_hDlg, IDC_ADAPTERFORMAT_COMBO ), false );
  423.         // Update resolution combo box
  424.         DWORD dwResolutionData;
  425.         TCHAR strResolution[50];
  426.         dwResolutionData = MAKELONG( m_d3dSettings.Windowed_DisplayMode.Width,
  427.                                      m_d3dSettings.Windowed_DisplayMode.Height );
  428.         _sntprintf( strResolution, 50, TEXT("%d by %d"), m_d3dSettings.Windowed_DisplayMode.Width, 
  429.             m_d3dSettings.Windowed_DisplayMode.Height );
  430.         strResolution[49] = 0;
  431.         ComboBoxClear( IDC_RESOLUTION_COMBO );
  432.         ComboBoxAdd( IDC_RESOLUTION_COMBO, ULongToPtr(dwResolutionData), strResolution );
  433.         ComboBoxSelectIndex( IDC_RESOLUTION_COMBO, 0 );
  434.         EnableWindow( GetDlgItem( m_hDlg, IDC_RESOLUTION_COMBO ), false );
  435.         // Update refresh rate combo box
  436.         TCHAR strRefreshRate[50];
  437.         if( m_d3dSettings.Windowed_DisplayMode.RefreshRate == 0 )
  438.             lstrcpy( strRefreshRate, TEXT("Default Rate") );
  439.         else
  440.             _sntprintf( strRefreshRate, 50, TEXT("%d Hz"), m_d3dSettings.Windowed_DisplayMode.RefreshRate );
  441.         strRefreshRate[49] = 0;
  442.         ComboBoxClear( IDC_REFRESHRATE_COMBO );
  443.         ComboBoxAdd( IDC_REFRESHRATE_COMBO, ULongToPtr(m_d3dSettings.Windowed_DisplayMode.RefreshRate),
  444.             strRefreshRate );
  445.         ComboBoxSelectIndex( IDC_REFRESHRATE_COMBO, 0 );
  446.         EnableWindow( GetDlgItem( m_hDlg, IDC_REFRESHRATE_COMBO ), false );
  447.     }
  448.     else
  449.     {
  450.         m_d3dSettings.IsWindowed = false;
  451.         m_d3dSettings.pFullscreen_AdapterInfo = pAdapterInfo;
  452.         m_d3dSettings.pFullscreen_DeviceInfo = pDeviceInfo;
  453.         // Update device clip check box
  454.         EnableWindow( GetDlgItem( m_hDlg, IDC_DEVICECLIP_CHECK ), false );
  455.         // Update adapter format combo box
  456.         ComboBoxClear( IDC_ADAPTERFORMAT_COMBO );
  457.         for( UINT idc = 0; idc < pDeviceInfo->pDeviceComboList->Count(); idc++ )
  458.         {
  459.             D3DDeviceCombo* pDeviceCombo = (D3DDeviceCombo*)pDeviceInfo->pDeviceComboList->GetPtr(idc);
  460.             if( pDeviceCombo->IsWindowed )
  461.                 continue;
  462.             D3DFORMAT adapterFormat = pDeviceCombo->AdapterFormat;
  463.             if( !ComboBoxContainsText( IDC_ADAPTERFORMAT_COMBO, D3DUtil_D3DFormatToString( adapterFormat ) ) )
  464.             {
  465.                 ComboBoxAdd( IDC_ADAPTERFORMAT_COMBO, (void*)adapterFormat, 
  466.                     D3DUtil_D3DFormatToString( adapterFormat ) );
  467.                 if( adapterFormat == m_d3dSettings.Fullscreen_DisplayMode.Format )
  468.                 {
  469.                     ComboBoxSelect( IDC_ADAPTERFORMAT_COMBO, (void*)adapterFormat );
  470.                 }
  471.             }
  472.         }
  473.         if( !ComboBoxSomethingSelected( IDC_ADAPTERFORMAT_COMBO ) &&
  474.             ComboBoxCount( IDC_ADAPTERFORMAT_COMBO ) > 0 )
  475.         {
  476.             ComboBoxSelectIndex( IDC_ADAPTERFORMAT_COMBO, 0 );
  477.         }
  478.         EnableWindow( GetDlgItem( m_hDlg, IDC_ADAPTERFORMAT_COMBO), true );
  479.         
  480.         // Update resolution combo box
  481.         EnableWindow( GetDlgItem( m_hDlg, IDC_RESOLUTION_COMBO), true );
  482.         
  483.         // Update refresh rate combo box
  484.         EnableWindow( GetDlgItem( m_hDlg, IDC_REFRESHRATE_COMBO), true );
  485.     }
  486. }
  487. //-----------------------------------------------------------------------------
  488. // Name: AdapterFormatChanged
  489. // Desc: Respond to a change of selected adapter format by rebuilding the
  490. //       resolution list and back buffer format list.  Updating the selected 
  491. //       resolution and back buffer format will trigger updates of the rest 
  492. //       of the dialog.
  493. //-----------------------------------------------------------------------------
  494. void CD3DSettingsDialog::AdapterFormatChanged( void )
  495. {
  496.     if( !IsDlgButtonChecked( m_hDlg, IDC_WINDOW ) )
  497.     {
  498.         D3DAdapterInfo* pAdapterInfo = (D3DAdapterInfo*)ComboBoxSelected( IDC_ADAPTER_COMBO );
  499.         D3DFORMAT adapterFormat = (D3DFORMAT)PtrToUlong( ComboBoxSelected( IDC_ADAPTERFORMAT_COMBO ) );
  500.         m_d3dSettings.Fullscreen_DisplayMode.Format = adapterFormat;
  501.         ComboBoxClear( IDC_RESOLUTION_COMBO );
  502.         for( UINT idm = 0; idm < pAdapterInfo->pDisplayModeList->Count(); idm++ )
  503.         {
  504.             D3DDISPLAYMODE displayMode = *(D3DDISPLAYMODE*)pAdapterInfo->pDisplayModeList->GetPtr(idm);
  505.             if (displayMode.Format == adapterFormat)
  506.             {
  507.                 DWORD dwResolutionData;
  508.                 TCHAR strResolution[50];
  509.                 dwResolutionData = MAKELONG( displayMode.Width, displayMode.Height );
  510.                 _sntprintf( strResolution, 50, TEXT("%d by %d"), displayMode.Width, displayMode.Height );
  511.                 strResolution[49] = 0;
  512.                 if (!ComboBoxContainsText( IDC_RESOLUTION_COMBO, strResolution ) )
  513.                 {
  514.                     ComboBoxAdd( IDC_RESOLUTION_COMBO, ULongToPtr( dwResolutionData ), strResolution );
  515.                     if (m_d3dSettings.Fullscreen_DisplayMode.Width == displayMode.Width &&
  516.                         m_d3dSettings.Fullscreen_DisplayMode.Height == displayMode.Height)
  517.                     {
  518.                         ComboBoxSelect( IDC_RESOLUTION_COMBO, ULongToPtr( dwResolutionData ) );
  519.                     }
  520.                 }
  521.             }
  522.         }
  523.         if (!ComboBoxSomethingSelected( IDC_RESOLUTION_COMBO ) && 
  524.             ComboBoxCount( IDC_RESOLUTION_COMBO ) > 0)
  525.         {
  526.             ComboBoxSelectIndex( IDC_RESOLUTION_COMBO, 0 );
  527.         }
  528.     }
  529.     // Update backbuffer format combo box
  530.     D3DDeviceInfo* pDeviceInfo = (D3DDeviceInfo*)ComboBoxSelected( IDC_DEVICE_COMBO );
  531.     if( pDeviceInfo == NULL )
  532.         return;
  533.     bool bHasWindowedBackbuffer = false;
  534.     ComboBoxClear( IDC_BACKBUFFERFORMAT_COMBO );
  535.     for( UINT idc = 0; idc < pDeviceInfo->pDeviceComboList->Count(); idc++ )
  536.     {
  537.         D3DDeviceCombo* pDeviceCombo = (D3DDeviceCombo*)pDeviceInfo->pDeviceComboList->GetPtr(idc);
  538.         if (pDeviceCombo->IsWindowed == m_d3dSettings.IsWindowed &&
  539.             pDeviceCombo->AdapterFormat == m_d3dSettings.DisplayMode().Format)
  540.         {
  541.             if (!ComboBoxContainsText( IDC_BACKBUFFERFORMAT_COMBO, 
  542.                 D3DUtil_D3DFormatToString( pDeviceCombo->BackBufferFormat ) ) )
  543.             {
  544.                 ComboBoxAdd( IDC_BACKBUFFERFORMAT_COMBO, (void*)pDeviceCombo->BackBufferFormat,
  545.                     D3DUtil_D3DFormatToString( pDeviceCombo->BackBufferFormat ) );
  546.                 if (pDeviceCombo->BackBufferFormat == m_d3dSettings.BackBufferFormat() )
  547.                     ComboBoxSelect( IDC_BACKBUFFERFORMAT_COMBO, (void*)pDeviceCombo->BackBufferFormat );
  548.             }
  549.         }
  550.         // Count the number of backbuffer format supported for windowed mode
  551.         if( true == pDeviceCombo->IsWindowed &&
  552.             pDeviceCombo->AdapterFormat == m_d3dSettings.Windowed_DisplayMode.Format )
  553.         {
  554.             bHasWindowedBackbuffer = true;
  555.         }
  556.     }
  557.     // If no backbuffer format is allowed and this is windowed, then the adapter
  558.     // cannot handle 3D in the format the desktop is currently in.  Force
  559.     // fullscreen in this case.
  560.     if( !bHasWindowedBackbuffer )
  561.     {
  562.         EnableWindow( GetDlgItem( m_hDlg, IDC_WINDOW ), FALSE );
  563.         if( m_d3dSettings.IsWindowed )
  564.         {
  565.             CheckRadioButton( m_hDlg, IDC_WINDOW, IDC_FULLSCREEN, IDC_FULLSCREEN );
  566.             WindowedFullscreenChanged();
  567.         }
  568.     }
  569.     if (!ComboBoxSomethingSelected( IDC_BACKBUFFERFORMAT_COMBO ) && 
  570.         ComboBoxCount( IDC_BACKBUFFERFORMAT_COMBO ) > 0)
  571.     {
  572.         ComboBoxSelectIndex( IDC_BACKBUFFERFORMAT_COMBO, 0 );
  573.     }
  574. }
  575. //-----------------------------------------------------------------------------
  576. // Name: ResolutionChanged
  577. // Desc: Respond to a change of selected resolution by rebuilding the
  578. //       refresh rate list.
  579. //-----------------------------------------------------------------------------
  580. void CD3DSettingsDialog::ResolutionChanged( void )
  581. {
  582.     if (m_d3dSettings.IsWindowed)
  583.         return;
  584.     D3DAdapterInfo* pAdapterInfo = (D3DAdapterInfo*)ComboBoxSelected( IDC_ADAPTER_COMBO );
  585.     if( pAdapterInfo == NULL )
  586.         return;
  587.     // Update settingsNew with new resolution
  588.     DWORD dwResolutionData = PtrToUlong( ComboBoxSelected( IDC_RESOLUTION_COMBO ) );
  589.     UINT width = LOWORD( dwResolutionData );
  590.     UINT height = HIWORD( dwResolutionData );
  591.     m_d3dSettings.Fullscreen_DisplayMode.Width = width;
  592.     m_d3dSettings.Fullscreen_DisplayMode.Height = height;
  593.     // Update refresh rate list based on new resolution
  594.     D3DFORMAT adapterFormat = (D3DFORMAT)PtrToUlong( ComboBoxSelected( IDC_ADAPTERFORMAT_COMBO ) );
  595.     ComboBoxClear( IDC_REFRESHRATE_COMBO );
  596.     for( UINT idm = 0; idm < pAdapterInfo->pDisplayModeList->Count(); idm++ )
  597.     {
  598.         D3DDISPLAYMODE displayMode = *(D3DDISPLAYMODE*)pAdapterInfo->pDisplayModeList->GetPtr(idm);
  599.         if (displayMode.Format == adapterFormat &&
  600.             displayMode.Width  == width &&
  601.             displayMode.Height == height)
  602.         {
  603.             TCHAR strRefreshRate[50];
  604.             if( displayMode.RefreshRate == 0 )
  605.                 lstrcpy( strRefreshRate, TEXT("Default Rate") );
  606.             else
  607.                 _sntprintf( strRefreshRate, 50, TEXT("%d Hz"), displayMode.RefreshRate );
  608.             strRefreshRate[49] = 0;
  609.             if( !ComboBoxContainsText( IDC_REFRESHRATE_COMBO, strRefreshRate ) )
  610.             {
  611.                 ComboBoxAdd( IDC_REFRESHRATE_COMBO, UlongToPtr( displayMode.RefreshRate ), strRefreshRate );
  612.                 if (m_d3dSettings.Fullscreen_DisplayMode.RefreshRate == displayMode.RefreshRate)
  613.                     ComboBoxSelect( IDC_REFRESHRATE_COMBO, UlongToPtr( displayMode.RefreshRate ) );
  614.             }
  615.         }
  616.     }
  617.     if (!ComboBoxSomethingSelected( IDC_REFRESHRATE_COMBO ) && 
  618.         ComboBoxCount( IDC_REFRESHRATE_COMBO ) > 0)
  619.     {
  620.         ComboBoxSelectIndex( IDC_REFRESHRATE_COMBO, 0 );
  621.     }
  622. }
  623. //-----------------------------------------------------------------------------
  624. // Name: RefreshRateChanged
  625. // Desc: Respond to a change of selected refresh rate.
  626. //-----------------------------------------------------------------------------
  627. void CD3DSettingsDialog::RefreshRateChanged( void )
  628. {
  629.     if( m_d3dSettings.IsWindowed )
  630.         return;
  631.     // Update settingsNew with new refresh rate
  632.     UINT refreshRate = PtrToUlong( ComboBoxSelected( IDC_REFRESHRATE_COMBO ) );
  633.     m_d3dSettings.Fullscreen_DisplayMode.RefreshRate = refreshRate;
  634. }
  635. //-----------------------------------------------------------------------------
  636. // Name: BackBufferFormatChanged
  637. // Desc: Respond to a change of selected back buffer format by rebuilding
  638. //       the depth/stencil format list, multisample type list, and vertex
  639. //       processing type list.
  640. //-----------------------------------------------------------------------------
  641. void CD3DSettingsDialog::BackBufferFormatChanged( void )
  642. {
  643.     D3DDeviceInfo* pDeviceInfo = (D3DDeviceInfo*)ComboBoxSelected( IDC_DEVICE_COMBO );
  644.     D3DFORMAT adapterFormat = (D3DFORMAT)PtrToUlong( ComboBoxSelected( IDC_ADAPTERFORMAT_COMBO ) );
  645.     D3DFORMAT backBufferFormat = (D3DFORMAT)PtrToUlong( ComboBoxSelected( IDC_BACKBUFFERFORMAT_COMBO ) );
  646.     if( pDeviceInfo == NULL )
  647.         return;
  648.     for( UINT idc = 0; idc < pDeviceInfo->pDeviceComboList->Count(); idc++ )
  649.     {
  650.         D3DDeviceCombo* pDeviceCombo = (D3DDeviceCombo*)pDeviceInfo->pDeviceComboList->GetPtr(idc);
  651.         if (pDeviceCombo->IsWindowed == m_d3dSettings.IsWindowed &&
  652.             pDeviceCombo->AdapterFormat == adapterFormat &&
  653.             pDeviceCombo->BackBufferFormat == backBufferFormat)
  654.         {
  655.             if( m_d3dSettings.IsWindowed )
  656.                 m_d3dSettings.pWindowed_DeviceCombo = pDeviceCombo;
  657.             else
  658.                 m_d3dSettings.pFullscreen_DeviceCombo = pDeviceCombo;
  659.             ComboBoxClear( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO );
  660.             if( m_pEnumeration->AppUsesDepthBuffer )
  661.             {
  662.                 for( UINT ifmt = 0; ifmt < pDeviceCombo->pDepthStencilFormatList->Count(); ifmt++ )
  663.                 {
  664.                     D3DFORMAT fmt = *(D3DFORMAT*)pDeviceCombo->pDepthStencilFormatList->GetPtr(ifmt);
  665.                     ComboBoxAdd( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO, (void*)fmt, 
  666.                         D3DUtil_D3DFormatToString(fmt) );
  667.                     if( fmt == m_d3dSettings.DepthStencilBufferFormat() )
  668.                         ComboBoxSelect( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO, (void*)fmt );
  669.                 }
  670.                 if (!ComboBoxSomethingSelected( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO ) && 
  671.                     ComboBoxCount( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO ) > 0)
  672.                 {
  673.                     ComboBoxSelectIndex( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO, 0 );
  674.                 }
  675.             }
  676.             else
  677.             {
  678.                 EnableWindow( GetDlgItem( m_hDlg, IDC_DEPTHSTENCILBUFFERFORMAT_COMBO ), false );
  679.                 ComboBoxAdd( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO, NULL, TEXT("(not used)") );
  680.                 ComboBoxSelectIndex( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO, 0 );
  681.             }
  682.             ComboBoxClear( IDC_VERTEXPROCESSING_COMBO );
  683.             for( UINT ivpt = 0; ivpt < pDeviceCombo->pVertexProcessingTypeList->Count(); ivpt++ )
  684.             {
  685.                 VertexProcessingType vpt = *(VertexProcessingType*)pDeviceCombo->pVertexProcessingTypeList->GetPtr(ivpt);
  686.                 ComboBoxAdd( IDC_VERTEXPROCESSING_COMBO, (void*)vpt, VertexProcessingTypeToString(vpt) );
  687.                 if( vpt == m_d3dSettings.GetVertexProcessingType() )
  688.                     ComboBoxSelect( IDC_VERTEXPROCESSING_COMBO, (void*)vpt );
  689.             }
  690.             if (!ComboBoxSomethingSelected( IDC_VERTEXPROCESSING_COMBO ) && 
  691.                 ComboBoxCount( IDC_VERTEXPROCESSING_COMBO ) > 0)
  692.             {
  693.                 ComboBoxSelectIndex( IDC_VERTEXPROCESSING_COMBO, 0 );
  694.             }
  695.             ComboBoxClear( IDC_PRESENTINTERVAL_COMBO );
  696.             for( UINT ipi = 0; ipi < pDeviceCombo->pPresentIntervalList->Count(); ipi++ )
  697.             {
  698.                 UINT pi = *(UINT*)pDeviceCombo->pPresentIntervalList->GetPtr(ipi);
  699.                 ComboBoxAdd( IDC_PRESENTINTERVAL_COMBO, UlongToPtr( pi ), PresentIntervalToString(pi) );
  700.                 if( pi == m_d3dSettings.PresentInterval() )
  701.                     ComboBoxSelect( IDC_PRESENTINTERVAL_COMBO, UlongToPtr( pi ) );
  702.             }
  703.             if (!ComboBoxSomethingSelected( IDC_PRESENTINTERVAL_COMBO ) && 
  704.                 ComboBoxCount( IDC_PRESENTINTERVAL_COMBO ) > 0)
  705.             {
  706.                 ComboBoxSelectIndex( IDC_PRESENTINTERVAL_COMBO, 0 );
  707.             }
  708.             break;
  709.         }
  710.     }
  711. }
  712. //-----------------------------------------------------------------------------
  713. // Name: DepthStencilBufferFormatChanged
  714. // Desc: Respond to a change of selected depth/stencil buffer format.
  715. //-----------------------------------------------------------------------------
  716. void CD3DSettingsDialog::DepthStencilBufferFormatChanged( void )
  717. {
  718.     D3DFORMAT fmt = (D3DFORMAT)PtrToUlong( ComboBoxSelected( IDC_DEPTHSTENCILBUFFERFORMAT_COMBO ) );
  719.     if( m_pEnumeration->AppUsesDepthBuffer )
  720.         m_d3dSettings.SetDepthStencilBufferFormat( fmt );
  721.     // Build multisample list
  722.     D3DDeviceCombo* pDeviceCombo = m_d3dSettings.PDeviceCombo();
  723.     ComboBoxClear( IDC_MULTISAMPLE_COMBO );
  724.     for( UINT ims = 0; ims < pDeviceCombo->pMultiSampleTypeList->Count(); ims++ )
  725.     {
  726.         D3DMULTISAMPLE_TYPE msType = *(D3DMULTISAMPLE_TYPE*)pDeviceCombo->pMultiSampleTypeList->GetPtr(ims);
  727.         // check for DS/MS conflicts
  728.         BOOL bConflictFound = FALSE;
  729.         for( UINT iConf = 0; iConf < pDeviceCombo->pDSMSConflictList->Count(); iConf++ )
  730.         {
  731.             D3DDSMSConflict* pDSMSConf = (D3DDSMSConflict*)pDeviceCombo->pDSMSConflictList->GetPtr(iConf);
  732.             if( pDSMSConf->DSFormat == fmt && pDSMSConf->MSType == msType )
  733.             {
  734.                 bConflictFound = TRUE;
  735.                 break;
  736.             }
  737.         }
  738.         if( !bConflictFound )
  739.         {
  740.             ComboBoxAdd( IDC_MULTISAMPLE_COMBO, (void*)msType, MultisampleTypeToString(msType) );
  741.             if( msType == m_d3dSettings.MultisampleType() )
  742.                 ComboBoxSelect( IDC_MULTISAMPLE_COMBO, (void*)msType );
  743.         }
  744.     }
  745.     if (!ComboBoxSomethingSelected( IDC_MULTISAMPLE_COMBO ) && 
  746.         ComboBoxCount( IDC_MULTISAMPLE_COMBO ) > 0)
  747.     {
  748.         ComboBoxSelectIndex( IDC_MULTISAMPLE_COMBO, 0 );
  749.     }
  750. }
  751. //-----------------------------------------------------------------------------
  752. // Name: MultisampleTypeChanged
  753. // Desc: Respond to a change of selected multisample type.
  754. //-----------------------------------------------------------------------------
  755. void CD3DSettingsDialog::MultisampleTypeChanged( void )
  756. {
  757.     D3DMULTISAMPLE_TYPE mst = (D3DMULTISAMPLE_TYPE)PtrToUlong( ComboBoxSelected( IDC_MULTISAMPLE_COMBO ) );
  758.     m_d3dSettings.SetMultisampleType( mst );
  759.     // Set up max quality for this mst
  760.     D3DDeviceCombo* pDeviceCombo = m_d3dSettings.PDeviceCombo();
  761.     DWORD maxQuality = 0;
  762.     for( UINT ims = 0; ims < pDeviceCombo->pMultiSampleTypeList->Count(); ims++ )
  763.     {
  764.         D3DMULTISAMPLE_TYPE msType = *(D3DMULTISAMPLE_TYPE*)pDeviceCombo->pMultiSampleTypeList->GetPtr(ims);
  765.         if( msType == mst )
  766.         {
  767.             maxQuality = *(DWORD*)pDeviceCombo->pMultiSampleQualityList->GetPtr(ims);
  768.             break;
  769.         }
  770.     }
  771.     ComboBoxClear( IDC_MULTISAMPLE_QUALITY_COMBO );
  772.     for( UINT msq = 0; msq < maxQuality; msq++ )
  773.     {
  774.         TCHAR str[100];
  775.         wsprintf( str, TEXT("%d"), msq );
  776.         ComboBoxAdd( IDC_MULTISAMPLE_QUALITY_COMBO, UlongToPtr( msq ), str );
  777.         if( msq == m_d3dSettings.MultisampleQuality() )
  778.             ComboBoxSelect( IDC_MULTISAMPLE_QUALITY_COMBO, UlongToPtr( msq ) );
  779.     }
  780.     if (!ComboBoxSomethingSelected( IDC_MULTISAMPLE_QUALITY_COMBO ) && 
  781.         ComboBoxCount( IDC_MULTISAMPLE_QUALITY_COMBO ) > 0)
  782.     {
  783.         ComboBoxSelectIndex( IDC_MULTISAMPLE_QUALITY_COMBO, 0 );
  784.     }
  785. }
  786. //-----------------------------------------------------------------------------
  787. // Name: MultisampleQualityChanged
  788. // Desc: Respond to a change of selected multisample quality.
  789. //-----------------------------------------------------------------------------
  790. void CD3DSettingsDialog::MultisampleQualityChanged( void )
  791. {
  792.     DWORD msq = (DWORD)PtrToUlong( ComboBoxSelected( IDC_MULTISAMPLE_QUALITY_COMBO ) );
  793.     m_d3dSettings.SetMultisampleQuality( msq );
  794. }
  795. //-----------------------------------------------------------------------------
  796. // Name: VertexProcessingChanged
  797. // Desc: Respond to a change of selected vertex processing type.
  798. //-----------------------------------------------------------------------------
  799. void CD3DSettingsDialog::VertexProcessingChanged( void )
  800. {
  801.     VertexProcessingType vpt = (VertexProcessingType)PtrToUlong( ComboBoxSelected( IDC_VERTEXPROCESSING_COMBO ) );
  802.     m_d3dSettings.SetVertexProcessingType( vpt );
  803. }
  804. //-----------------------------------------------------------------------------
  805. // Name: PresentIntervalChanged
  806. // Desc: Respond to a change of selected present interval.
  807. //-----------------------------------------------------------------------------
  808. void CD3DSettingsDialog::PresentIntervalChanged( void )
  809. {
  810.     UINT pi = PtrToUlong( ComboBoxSelected( IDC_PRESENTINTERVAL_COMBO ) );
  811.     m_d3dSettings.SetPresentInterval( pi );
  812. }
  813. //-----------------------------------------------------------------------------
  814. // Name: DeviceClipChanged
  815. // Desc: Respond to a change of selected present interval.
  816. //-----------------------------------------------------------------------------
  817. void CD3DSettingsDialog::DeviceClipChanged( void )
  818. {
  819.     HWND hWndCheckBox = GetDlgItem( m_hDlg, IDC_DEVICECLIP_CHECK );
  820.     if( hWndCheckBox )
  821.     {
  822.         bool bChecked = SendMessage( hWndCheckBox, BM_GETCHECK, 0, 0 ) == BST_CHECKED;
  823.         m_d3dSettings.SetDeviceClip( bChecked );
  824.     }
  825. }