|
//-----------------------------------------------------------------------------
// XD3DSettings.cpp: settings class for the XD3D framework
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include "XD3DSettings.h"
//-----------------------------------------------------------------------------
// Settings constructor: sizes the arrays to 2 growing in 2s, to save some
// memory (the default grow factor is 8, but we only need 2). It also
// initialises the DeviceInfo and DeviceCombo position indices, and defaults
// to Windowed, but notice that we will not get any meaningful values until
// the settings get initialised by the CXD3D class; the values will just
// save an access violation.
//-----------------------------------------------------------------------------
CXD3DSettings::CXD3DSettings()
{
AdapterInfos.SetGrowFactor(2);
AdapterInfos.SetLength(2);
ndm[0] = ndm[1] = ndi[0] = ndi[1] = ndc[0] = ndc[1] = 0;
Windowed = 1;
nDSFormat = 0;
};
// adapter info wrapper, based on the windowed index
AdapterInfo* CXD3DSettings::GetAdapterInfo()
{
return AdapterInfos[Windowed];
}
// device info wrapper, based on the windowed index and the di index
DeviceInfo* CXD3DSettings::GetDeviceInfo()
{
return &AdapterInfos[Windowed]->DeviceInfos[ndi[Windowed]];
}
// display mode wrapper, based on the windowed index
D3DDISPLAYMODE CXD3DSettings::GetDisplayMode()
{
return AdapterInfos[Windowed]->DisplayModes[ndm[Windowed]];
}
// VP type wrapper
VPTYPE CXD3DSettings::GetVPType()
{
return (VPTYPE)AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
VPTypes[0];
}
// back buffer format wrapper
D3DFORMAT CXD3DSettings::GetBackBufferFormat()
{
return (D3DFORMAT)AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
BackBufferFormat;
}
// depth/stencil format wrapper
D3DFORMAT CXD3DSettings::GetDSFormat()
{
return (D3DFORMAT)AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
DSFormats[nDSFormat];
}
// multisampling wrapper
D3DMULTISAMPLE_TYPE CXD3DSettings::GetMSType()
{
return (D3DMULTISAMPLE_TYPE)AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
MSTypes[0];
}
// multisampling quality levels wrapper
DWORD CXD3DSettings::GetMSQuality()
{
return (DWORD)AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
MSQualityLevels[0];
}
// presentation interval wrapper
DWORD CXD3DSettings::GetPresentInterval()
{
return (DWORD)AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
PresentIntervals[0];
}
// Set DS format wrapper
void CXD3DSettings::SetDSFormat(UINT nFmt)
{
if (nFmt < AdapterInfos[Windowed]->
DeviceInfos[ndi[Windowed]].
DeviceCombos[ndc[Windowed]].
DSFormats.Length())
nDSFormat = nFmt;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Professional software engineer with 30+ years of experience delivering systems across diverse industries, looking for the next opportunity to deliver cutting edge end-to-end technology solutions.
Avid reader, disciplined writer and enthusiastic tinkerer with a background in electronics, looking inside and thinking outside the box, genuinely passionate about robust, extensible, reusable and performant code.
Framework developer leading, coaching and learning about best practices, code quality, DevOps and software and data lifecycle management with an agile mindset to create the most elegant and sustainable solutions.