Original Post
Hey guys, sorry for the newb question but, this code doesn't work in fullscreen (surprised?) I get an error on the CreateDevice() call, I tried looking it up but it was some weird negative number that didn't match anything. Oh, and it doesn't work in REF either. I hate this bug, please squash it :) EDIT: Addled "[solved]" to title. What a newbish thread of mine :/ [Edited by - The Forgotten Mindset on July 2, 2005 12:43:43 AM]
// Initialize D3D!!!!!! //
D3DDISPLAYMODE d3ddm;
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3ddm, sizeof(d3ddm));
ZeroMemory(&d3dpp, sizeof(d3dpp));
if((m_pD3D = Direct3DCreate8(D3D_SDK_VERSION))==NULL)
return FALSE;
if( m_Windowed ) // Works
{
if(FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
return FALSE;
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
d3dpp.BackBufferFormat = d3ddm.Format;
}
else // Make FullScreen -Doesn't work
{
// Find the matching fullscreen display mode
for(UINT x = 0; x < m_pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT); x++)
{
m_pD3D->EnumAdapterModes(0, x, &d3ddm);
if(d3ddm.Width == m_Width)
{
if(d3ddm.Height == m_Height)
{
if((d3ddm.Format == D3DFMT_R5G6B5) || (d3ddm.Format == D3DFMT_X1R5G5B5)
|| (d3ddm.Format == D3DFMT_X4R4G4B4))
{
if(m_Depth == 16)
{
break; // found the right format
}
}
else if((d3ddm.Format == D3DFMT_R8G8B8) || (d3ddm.Format == D3DFMT_X8R8G8B8))
{
if(m_Depth == 32)
{
break; // found the right format
}
}
}
}// end for loop
}
d3dpp.Windowed = FALSE;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferWidth = m_Width;
d3dpp.BackBufferHeight = m_Height;
d3dpp.BackBufferFormat = m_Format = d3ddm.Format;
}// end else if fullscreen
//Create a Direct3D device.
if(FAILED(m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &m_pD3DDevice)))
return FALSE; // enters here, it failed