Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cDXSettings.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cDXSettings_H
7 #define _INC_cDXSettings_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cDXBase.h"
13 #include "cDXEnumeration.h"
15 
16 #ifdef USE_DX9
17 
18 namespace Gray3D
19 {
20  class GRAY3D_LINK cDXSettingsMode
21  {
24 
25  public:
26  D3DDISPLAYMODE m_DisplayMode;
27 
28  // Selections for m_pCombo
29  D3DFORMAT m_eFormatDepthStencilBuffer;
30  D3DMULTISAMPLE_TYPE m_eMultisampleType;
31  DWORD m_MultisampleQuality;
32  VertexProcessing_TYPE m_eVertexProcessingType;
33  UINT m_PresentInterval;
34 
35  private:
36  cDXEnumComboPtr m_pCombo;
37  cDXEnumDevicePtr m_pDevice;
38  cDXEnumAdapterPtr m_pAdapter;
39 
40  public:
41  cDXSettingsMode();
42  ~cDXSettingsMode();
43 
44  void put_Combo(cDXEnumCombo* pCombo);
45  void SetMode(const D3DDISPLAYMODE& DisplayMode, cDXEnumCombo* pCombo, bool bUsesDepthBuffer);
46 
47  cDXEnumComboPtr get_Combo() const noexcept
48  {
49  return m_pCombo;
50  }
51  cDXEnumDevicePtr get_Device() const noexcept
52  {
53  return m_pDevice;
54  }
55  cDXEnumAdapterPtr get_Adapter() const noexcept
56  {
57  return m_pAdapter;
58  }
59 
60  bool isFullscreen() const
61  {
62  ASSERT(m_pCombo != nullptr);
63  return m_pCombo->isFullscreen();
64  }
65 
66  void GetPresentParams(D3DPRESENT_PARAMETERS& pp) const;
67  };
68 
69  class GRAY3D_LINK cDXSettings
70  {
74 
75  public:
76  bool m_bFullScreenMode;
77 
78  public:
79  cDXSettingsMode m_FullScreen;
80  cDXSettingsMode m_Windowed;
81 
82  bool m_bDeviceClip;
83 
84  private:
85  bool SetBestModeFullScreen(const cDXEnumeration& d3dEnumeration, bool bRequireREF, const cWinSize& szFullScreen);
86 
87  public:
88  bool SetBestModeWindowed(const cDXEnumeration& d3dEnumeration, bool bRequireREF);
89  HRESULT SetBestMode(const cDXEnumeration& d3dEnumeration, bool bRequireREF, bool bFullScreenPref, const cWinSize& szFullScreen);
90 
91  bool isFullScreenMode() const noexcept
92  {
93  return m_bFullScreenMode;
94  }
95  cDXSettingsMode& ref_Mode() noexcept
96  {
97  return m_bFullScreenMode ? m_FullScreen : m_Windowed;
98  }
99  const cDXSettingsMode& get_Mode() const noexcept
100  {
101  // Get the current settings mode.
102  return m_bFullScreenMode ? m_FullScreen : m_Windowed;
103  }
104 
105  cDXEnumAdapterPtr get_Adapter() const
106  {
107  return get_Mode().get_Adapter();
108  }
109  cDXEnumDevicePtr get_Device() const
110  {
111  return get_Mode().get_Device();
112  }
113  cDXEnumComboPtr get_Combo() const
114  {
115  return get_Mode().get_Combo();
116  }
117 
118  int get_AdapterOrdinal() const
119  {
121  cDXEnumComboPtr pCombo = get_Combo();
122  if (pCombo == nullptr)
123  return -1;
124  return pCombo->get_AdapterOrdinal();
125  }
126  D3DDEVTYPE get_DevType() const
127  {
128  return get_Device()->m_eDevType;
129  }
130  D3DFORMAT get_BackBufferFormat() const
131  {
132  return get_Combo()->m_eFormatBackBuffer;
133  }
134 
135  void GetPresentParams(D3DPRESENT_PARAMETERS& pp) const;
136  };
137 }
138 #endif // USE_DX9
139 #endif // _INC_cDXSettings_H
#define GRAY3D_LINK
Definition: Gray3D.h:15
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
D3DDEVTYPE
Definition: UseDX.h:318
enum _D3DFORMAT D3DFORMAT
enum _D3DMULTISAMPLE_TYPE D3DMULTISAMPLE_TYPE
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: Gray3D.cpp:12
Definition: UseDX.h:263