home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Samples / C++ / Common / DXUTSettingsDlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-27  |  4.8 KB  |  140 lines

  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_WINDOWED_GROUP          0x0100
  35.  
  36.  
  37. //--------------------------------------------------------------------------------------
  38. // Dialog for selection of device settings 
  39. // Use DXUTGetSettingsDialog() to access global instance
  40. // To control the contents of the dialog, use the CD3DEnumeration class.
  41. //--------------------------------------------------------------------------------------
  42. class CD3DSettingsDlg
  43. {
  44. public:
  45.     HRESULT OnCreateDevice( IDirect3DDevice9* pd3dDevice );
  46.     HRESULT Refresh();
  47.     HRESULT OnResetDevice();
  48.     HRESULT OnLostDevice();
  49.     HRESULT OnRender( float fElapsedTime );
  50.     HRESULT OnDestroyDevice();
  51.  
  52.     CDXUTDialog* GetDialogControl() { return &m_Dialog; }
  53.  
  54.     LRESULT HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  55.  
  56.     ~CD3DSettingsDlg();
  57.  
  58. protected:
  59.     friend CD3DSettingsDlg* DXUTGetSettingsDialog();
  60.  
  61.     // Use DXUTGetSettingsDialog() to access global instance
  62.     CD3DSettingsDlg();
  63.  
  64.     void CreateControls();
  65.     HRESULT SetDeviceSettingsFromUI();
  66.  
  67.     void OnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl );
  68.     static void WINAPI StaticOnEvent( UINT nEvent, int nControlID, CDXUTControl* pControl );
  69.  
  70.     CD3DEnumAdapterInfo* GetCurrentAdapterInfo();
  71.     CD3DEnumDeviceInfo* GetCurrentDeviceInfo();
  72.     CD3DEnumDeviceSettingsCombo* GetCurrentDeviceSettingsCombo();
  73.  
  74.     void AddAdapter( const WCHAR* strDescription, UINT iAdapter );
  75.     UINT GetSelectedAdapter();
  76.  
  77.     void AddDeviceType( D3DDEVTYPE devType );
  78.     D3DDEVTYPE GetSelectedDeviceType();
  79.  
  80.     void SetWindowed( bool bWindowed );
  81.     bool IsWindowed();
  82.  
  83.     void AddAdapterFormat( D3DFORMAT format );
  84.     D3DFORMAT GetSelectedAdapterFormat();
  85.  
  86.     void AddResolution( DWORD dwWidth, DWORD dwHeight );
  87.     void GetSelectedResolution( DWORD* pdwWidth, DWORD* pdwHeight );
  88.  
  89.     void AddRefreshRate( DWORD dwRate );
  90.     DWORD GetSelectedRefreshRate();
  91.  
  92.     void AddBackBufferFormat( D3DFORMAT format );
  93.     D3DFORMAT GetSelectedBackBufferFormat();
  94.  
  95.     void AddDepthStencilBufferFormat( D3DFORMAT format );
  96.     D3DFORMAT GetSelectedDepthStencilBufferFormat();
  97.  
  98.     void AddMultisampleType( D3DMULTISAMPLE_TYPE type );
  99.     D3DMULTISAMPLE_TYPE GetSelectedMultisampleType();
  100.  
  101.     void AddMultisampleQuality( DWORD dwQuality );
  102.     DWORD GetSelectedMultisampleQuality();
  103.  
  104.     void AddVertexProcessingType( DWORD dwType );
  105.     DWORD GetSelectedVertexProcessingType();
  106.  
  107.     void AddPresentInterval( DWORD dwInterval );
  108.     DWORD GetSelectedPresentInterval();
  109.  
  110.     void SetDeviceClip( bool bDeviceClip );
  111.     bool IsDeviceClip();
  112.  
  113.     HRESULT OnAdapterChanged();
  114.     HRESULT OnDeviceTypeChanged();
  115.     HRESULT OnWindowedFullScreenChanged();
  116.     HRESULT OnAdapterFormatChanged();
  117.     HRESULT OnResolutionChanged();
  118.     HRESULT OnRefreshRateChanged();
  119.     HRESULT OnBackBufferFormatChanged();
  120.     HRESULT OnDepthStencilBufferFormatChanged();
  121.     HRESULT OnMultisampleTypeChanged();
  122.     HRESULT OnMultisampleQualityChanged();
  123.     HRESULT OnVertexProcessingChanged();
  124.     HRESULT OnPresentIntervalChanged();
  125.     HRESULT OnDeviceClipChanged();
  126.  
  127.     CDXUTDialog m_Dialog;
  128.  
  129.     DWORD m_dwWindowWidth;
  130.     DWORD m_dwWindowHeight;
  131. };
  132.  
  133.  
  134. CD3DSettingsDlg* DXUTGetSettingsDialog();
  135.  
  136.  
  137.  
  138. #endif
  139.  
  140.