Skip to main content
GameDev.net gamedev.net
🔒 Locked

Help :(

Started by VladWorks Jul 5, 2004 at 6:29 PM 7 replies 550+ views
Original Post
VladWorks
VladWorks
Ok so Im writing one programm and I keep getting this error... error C2440: 'type cast' : cannot convert from 'D3DDISPLAYMODE *' to 'D3DFORMAT' On this line: if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3ddm, &d3ddm, FALSE))) return FALSE; Please help me.. P.S, d3ddm is a D3DDISPLAYMODE object
"C" is like "C++" after you fail it 2 times!
VolkerG
VolkerG
And as the compiler tells you, parameter 3 and 4 must be a D3DFORMAT. Have a look at the SDK documentation ;)
D3DXVECTOR3
D3DXVECTOR3
For CheckDevice:

HRESULT CheckDeviceType
(
UINT Adapter,
D3DDEVTYPE DeviceType,
D3DFORMAT DisplayFormat,
D3DFORMAT BackBufferFormat,
BOOL Windowed
);

For D3DDISPLAYMODE:

typedef struct _D3DDISPLAYMODE
{
UINT Width;
UINT Height;
UINT RefreshRate;
D3DFORMAT Format;
} D3DDISPLAYMODE

And you need a D3DFORMAT, try d3dmm.Format.

ie :

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

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

needs to be changed to this:
if(FAILED(g_pD3D->CheckDeviceType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, *insert a D3DFORMAT enumeration* , *insert a D3DFORMAT enumeration*, FALSE)))

[edit] forgot second one.
VladWorks
VladWorks
D3DXVECTOR3, After I changed the code to

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


I got:
error C2664: 'IDirect3D8::CheckDeviceType' : cannot convert parameter 3 from 'D3DFORMAT *' to 'D3DFORMAT'

and after I cast (vise versa) i still get the same error.


"C" is like "C++" after you fail it 2 times!
D3DXVECTOR3
D3DXVECTOR3
remove the '&' in &d3ddm.Format... > d3ddm.Format
That should do it

edit: both of them
VladWorks
VladWorks
Ok thanks a lot man! It worked.

I only have 1 more question and im out of your hair ...hehe



How can I change this, window code, to full screen
  // Create the Main Window  g_hWnd = CreateWindow(g_szClass, g_szCaption,        WS_CAPTION | WS_SYSMENU,        0, 0, 400, 400,        NULL, NULL,        hInst, NULL );  if(!g_hWnd)    return FALSE;  ShowWindow(g_hWnd, SW_NORMAL);  UpdateWindow(g_hWnd);
"C" is like "C++" after you fail it 2 times!
VolkerG
VolkerG
The Windowed member of the D3DPRESENT_PARAMETERS structure is used to choose.
D3DXVECTOR3
D3DXVECTOR3
^^ Yep, set the Windowed parameter in D3DPRESENT_PARAMETERS to true and your app will start in fullscreen mode.

D3DPRESENT_PARAMETERS d3dpp.

d3dpp.Windowed = true;

Edit:

This is when you create your LPDIRECT3DDEVICE9 with CreateDevice

Topic Locked

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

Sign in to reply to this topic.