Original Post
Hello! I started DirectX with andypike's DX8 tutorial, but when I got a new computer I found out that the new DX SDK had removed the DX8 headers. So I am porting everything to DX9! I had hoped it would be a simple matter of changing 8's to 9's, but alas, it is not. The biggest problem I'm having is how to detect the display mode? Previously, I was using something like this (okay, exactly like this):
D3DFORMAT CGame::CheckDisplayMode(UINT nWidth, UINT nHeight, UINT nDepth)
{
UINT x;
D3DDISPLAYMODE d3ddm;
for(x = 0; x < m_pD3D->GetAdapterModeCount(0); x++) //~(0, d3ddm.Format)
{
m_pD3D->EnumAdapterModes(0, x, &d3ddm); //~(0, d3ddm.Format, x, &d3ddm)
if(d3ddm.Width == nWidth)
{
if(d3ddm.Height == nHeight)
{
if((d3ddm.Format == D3DFMT_R5G6B5) || (d3ddm.Format == D3DFMT_X1R5G5B5) || (d3ddm.Format == D3DFMT_X4R4G4B4))
{
if(nDepth == 16)
{
return d3ddm.Format;
}
}
else if((d3ddm.Format == D3DFMT_R8G8B8) || (d3ddm.Format == D3DFMT_X8R8G8B8))
{
if(nDepth == 32)
{
return d3ddm.Format;
}
}
}
}
}
return D3DFMT_UNKNOWN;
}
Unfortunately in DX9 this doesn't work because you already need to know the display mode before you can even call this function! And that was the whole point! There is a pretty cool function IDirect3DSwapChain9::GetDisplayMode but unfortunately it's part of this thing called a "Swap Chain." What's that? Is there another way to do this? If I have any other problems I'll post 'em here, but this looks like the only irresolvable one.