DX7
heres my directx7 CreateSurface() code...
DDSURFACEDESC2 ddsd;
DDSCAPS2 ddscaps;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
if (ddrval!=DD_OK) {
ErrStr=Err_CreateSurf;
return FALSE;
}
i get an error on the line
ddrval = lpDD->CreateSurface..........etc
the error is
''CreateSurface'' : cannot convert parameter 1 from ''struct _DDSURFACEDESC2 *'' to ''struct _DDSURFACEDESC *''
i can see nothing wrong with the code..
please help
September 02, 2001 08:33 AM
When you declare ddsd, rather than: DDSURFACEDESC2 ddsd; try: DDSURFACEDESC ddsd;
when i change DDSURFACEDESC2 to DDSURFACEDESC it has yet another error saying
''CreateSurface'' : cannot convert parameter 2 from ''struct IDirectDrawSurface7 ** '' to ''struct IDirectDrawSurface ** ''
''CreateSurface'' : cannot convert parameter 2 from ''struct IDirectDrawSurface7 ** '' to ''struct IDirectDrawSurface ** ''
Are you sure you''re using DirectDraw 7? Show us the beginning of your initialization code.
heres the start of the initialization...
// Global interface pointers
LPDIRECTDRAW7 lpDD=NULL;
LPDIRECTDRAWSURFACE7 lpDDSPrimary=NULL;
LPDIRECTDRAWSURFACE7 lpDDSBack=NULL;
// Create the main DirectDraw object
ddrval = DirectDrawCreate(NULL, &lpDD, NULL);
if (ddrval != DD_OK) {
ErrStr=Err_DirectDrawCreate;
return FALSE;
}
// Fetch DirectDraw7 interface
ddrval = lpDD->QueryInterface(IID_IDirectDraw7, (LPVOID *) & lpDD);
if (ddrval != DD_OK) {
ErrStr=Err_Query;
return FALSE;
}
// set cooperative level
ddrval=lpDD->SetCooperativeLevel(hWnd,
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if (ddrval!=DD_OK) {
ErrStr=Err_Coop;
return FALSE;
}
// set the display mode
ddrval = lpDD->SetDisplayMode( 640, 480, 16);
if (ddrval!=DD_OK) {
ErrStr=Err_DispMode;
return FALSE;
}
// create primary surface with 1 back buffer
DDSURFACEDESC ddsd;
DDSCAPS2 ddscaps;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
if (ddrval!=DD_OK) {
ErrStr=Err_CreateSurf;
return FALSE;
}
// fetch back buffer interface
ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
ddrval=lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack);
if (ddrval!=DD_OK) {
ErrStr=Err_CreateSurf;
return FALSE;
}
if (!load_images())
return FALSE;
return TRUE;
}
(in fact, thats all of the init code)
// Global interface pointers
LPDIRECTDRAW7 lpDD=NULL;
LPDIRECTDRAWSURFACE7 lpDDSPrimary=NULL;
LPDIRECTDRAWSURFACE7 lpDDSBack=NULL;
// Create the main DirectDraw object
ddrval = DirectDrawCreate(NULL, &lpDD, NULL);
if (ddrval != DD_OK) {
ErrStr=Err_DirectDrawCreate;
return FALSE;
}
// Fetch DirectDraw7 interface
ddrval = lpDD->QueryInterface(IID_IDirectDraw7, (LPVOID *) & lpDD);
if (ddrval != DD_OK) {
ErrStr=Err_Query;
return FALSE;
}
// set cooperative level
ddrval=lpDD->SetCooperativeLevel(hWnd,
DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if (ddrval!=DD_OK) {
ErrStr=Err_Coop;
return FALSE;
}
// set the display mode
ddrval = lpDD->SetDisplayMode( 640, 480, 16);
if (ddrval!=DD_OK) {
ErrStr=Err_DispMode;
return FALSE;
}
// create primary surface with 1 back buffer
DDSURFACEDESC ddsd;
DDSCAPS2 ddscaps;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |
DDSCAPS_FLIP |
DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL );
if (ddrval!=DD_OK) {
ErrStr=Err_CreateSurf;
return FALSE;
}
// fetch back buffer interface
ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
ddrval=lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack);
if (ddrval!=DD_OK) {
ErrStr=Err_CreateSurf;
return FALSE;
}
if (!load_images())
return FALSE;
return TRUE;
}
(in fact, thats all of the init code)
You may have it figured out by now but DirectDrawCreate is not
a DirectDraw7 function you need the new one. Try this or switch
to non direct draw 7 types.
ddrval = DirectDrawCreateEx(NULL,(LPVOID*)&lpDD,IID_IDirectDraw7,NULL);
You are getting the error because DirectDrawCreate is looking
for an older type.
The new Param is always set to IID_IDirectDraw7.
Edited by - Goober King on September 7, 2001 1:45:43 AM
a DirectDraw7 function you need the new one. Try this or switch
to non direct draw 7 types.
ddrval = DirectDrawCreateEx(NULL,(LPVOID*)&lpDD,IID_IDirectDraw7,NULL);
You are getting the error because DirectDrawCreate is looking
for an older type.
The new Param is always set to IID_IDirectDraw7.
Edited by - Goober King on September 7, 2001 1:45:43 AM
------------------------------------------------------------- neglected projects Lore and The KeepersRandom artwork
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement