Skip to main content
gamedev.net
🔒 Locked

DisplayMode problem

Started by Hedos Oct 3, 2002 at 10:18 PM 1 replies 300+ views
Original Post
Hedos
Hedos
I want to use a function to check if the Display Mode can handle the color format, but I always obtain an error at compilation(I use Visual C++ 6.0): error C2664: ''CheckDeviceType'' : cannot convert parameter 3 from ''struct _D3DDISPLAYMODE *'' to ''enum _D3DFORMAT'' My code is: IDirect3D8 g_pD3D; D3DDISPLAYMODE d3ddm; if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,&d3ddm, &d3ddm, FALSE))) return FALSE; This code is from the book "Programming Role-Playing game with DirectX"
TheAIDSVirus
TheAIDSVirus
The third and fourth parameters of the CheckDeviceType function specify the front and back buffer formats that you intend to test. You are sending a pointer to the entire display mode structure. Instead of:

if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,&d3ddm, &d3ddm, FALSE)))

Try:

if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,d3ddm.Format,d3ddm.Format, FALSE)))

That may not work considering I don''t know if you''ve initialized d3ddm. If not, then just specify specific formats that you want to check. For example:

if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,D3DFMT_X8R8G8B8,D3DFMT_X8R8G8B8, FALSE)))

For a list of display formats, look up D3DFORMAT in the MSDN.

----
AIDS
----AIDS
Hedos
Hedos
Thanks it work perfectly !!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.