My Project
d3dsettings.h
1 //-----------------------------------------------------------------------------
2 // File: D3DSettings.h
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 #ifndef D3DSETTINGS_H
10 #define D3DSETTINGS_H
11 
12 
13 //-----------------------------------------------------------------------------
14 // Name: class CD3DSettings
15 // Desc: Current D3D settings: adapter, device, mode, formats, etc.
16 //-----------------------------------------------------------------------------
18 {
19 public:
20  bool IsWindowed;
21 
22  D3DAdapterInfo* pWindowed_AdapterInfo;
23  D3DDeviceInfo* pWindowed_DeviceInfo;
24  D3DDeviceCombo* pWindowed_DeviceCombo;
25 
26  D3DDISPLAYMODE Windowed_DisplayMode; // not changable by the user
27  D3DFORMAT Windowed_DepthStencilBufferFormat;
28  D3DMULTISAMPLE_TYPE Windowed_MultisampleType;
29  DWORD Windowed_MultisampleQuality;
30  VertexProcessingType Windowed_VertexProcessingType;
31  UINT Windowed_PresentInterval;
32  bool bDeviceClip;
33  int Windowed_Width;
34  int Windowed_Height;
35 
36  D3DAdapterInfo* pFullscreen_AdapterInfo;
37  D3DDeviceInfo* pFullscreen_DeviceInfo;
38  D3DDeviceCombo* pFullscreen_DeviceCombo;
39 
40  D3DDISPLAYMODE Fullscreen_DisplayMode; // changable by the user
41  D3DFORMAT Fullscreen_DepthStencilBufferFormat;
42  D3DMULTISAMPLE_TYPE Fullscreen_MultisampleType;
43  DWORD Fullscreen_MultisampleQuality;
44  VertexProcessingType Fullscreen_VertexProcessingType;
45  UINT Fullscreen_PresentInterval;
46 
47  D3DAdapterInfo* PAdapterInfo() { return IsWindowed ? pWindowed_AdapterInfo : pFullscreen_AdapterInfo; }
48  D3DDeviceInfo* PDeviceInfo() { return IsWindowed ? pWindowed_DeviceInfo : pFullscreen_DeviceInfo; }
49  D3DDeviceCombo* PDeviceCombo() { return IsWindowed ? pWindowed_DeviceCombo : pFullscreen_DeviceCombo; }
50 
51  int AdapterOrdinal() { return PDeviceCombo()->AdapterOrdinal; }
52  D3DDEVTYPE DevType() { return PDeviceCombo()->DevType; }
53  D3DFORMAT BackBufferFormat() { return PDeviceCombo()->BackBufferFormat; }
54 
55  D3DDISPLAYMODE DisplayMode() { return IsWindowed ? Windowed_DisplayMode : Fullscreen_DisplayMode; }
56  void SetDisplayMode(D3DDISPLAYMODE value) { if (IsWindowed) Windowed_DisplayMode = value; else Fullscreen_DisplayMode = value; }
57 
58  D3DFORMAT DepthStencilBufferFormat() { return IsWindowed ? Windowed_DepthStencilBufferFormat : Fullscreen_DepthStencilBufferFormat; }
59  void SetDepthStencilBufferFormat(D3DFORMAT value) { if (IsWindowed) Windowed_DepthStencilBufferFormat = value; else Fullscreen_DepthStencilBufferFormat = value; }
60 
61  D3DMULTISAMPLE_TYPE MultisampleType() { return IsWindowed ? Windowed_MultisampleType : Fullscreen_MultisampleType; }
62  void SetMultisampleType(D3DMULTISAMPLE_TYPE value) { if (IsWindowed) Windowed_MultisampleType = value; else Fullscreen_MultisampleType = value; }
63 
64  DWORD MultisampleQuality() { return IsWindowed ? Windowed_MultisampleQuality : Fullscreen_MultisampleQuality; }
65  void SetMultisampleQuality(DWORD value) { if (IsWindowed) Windowed_MultisampleQuality = value; else Fullscreen_MultisampleQuality = value; }
66 
67  VertexProcessingType GetVertexProcessingType() { return IsWindowed ? Windowed_VertexProcessingType : Fullscreen_VertexProcessingType; }
68  void SetVertexProcessingType(VertexProcessingType value) { if (IsWindowed) Windowed_VertexProcessingType = value; else Fullscreen_VertexProcessingType = value; }
69 
70  UINT PresentInterval() { return IsWindowed ? Windowed_PresentInterval : Fullscreen_PresentInterval; }
71  void SetPresentInterval(UINT value) { if (IsWindowed) Windowed_PresentInterval = value; else Fullscreen_PresentInterval = value; }
72 
73  bool DeviceClip() { return bDeviceClip; }
74  void SetDeviceClip( bool bClip ) { bDeviceClip = bClip; }
75 };
76 
77 
78 
79 
80 //-----------------------------------------------------------------------------
81 // Name: class CD3DSettingsDialog
82 // Desc: Dialog box to allow the user to change the D3D settings
83 //-----------------------------------------------------------------------------
85 {
86 private:
87  HWND m_hDlg;
88  CD3DEnumeration* m_pEnumeration;
89  CD3DSettings m_d3dSettings;
90 
91 private:
92  // ComboBox helper functions
93  void ComboBoxAdd( int id, void* pData, LPCTSTR pstrDesc );
94  void ComboBoxSelect( int id, void* pData );
95  void* ComboBoxSelected( int id );
96  bool ComboBoxSomethingSelected( int id );
97  UINT ComboBoxCount( int id );
98  void ComboBoxSelectIndex( int id, int index );
99  void ComboBoxClear( int id );
100  bool ComboBoxContainsText( int id, LPCTSTR pstrText );
101 
102  void AdapterChanged( void );
103  void DeviceChanged( void );
104  void WindowedFullscreenChanged( void );
105  void AdapterFormatChanged( void );
106  void ResolutionChanged( void );
107  void RefreshRateChanged( void );
108  void BackBufferFormatChanged( void );
109  void DepthStencilBufferFormatChanged( void );
110  void MultisampleTypeChanged( void );
111  void MultisampleQualityChanged( void );
112  void VertexProcessingChanged( void );
113  void PresentIntervalChanged( void );
114  void DeviceClipChanged( void );
115 
116 public:
117  CD3DSettingsDialog( CD3DEnumeration* pEnumeration, CD3DSettings* pSettings);
118  INT_PTR ShowDialog( HWND hwndParent, HINSTANCE hInst = 0);
119  INT_PTR DialogProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
120  void GetFinalSettings( CD3DSettings* pSettings ) { *pSettings = m_d3dSettings; }
121 };
122 
123 #endif
124 
125 
126 
Definition: d3dsettings.h:84
Definition: d3denumeration.h:98
Definition: d3denumeration.h:29
Definition: d3denumeration.h:44
Definition: d3denumeration.h:71
Definition: d3dsettings.h:17