以下是「Tricks.of.the.3D.Game.Programming.Gurus-Advanced.3D.Graphics.and.Rasterization」这本书的原例:
LPDIRECTDRAW lpdd = NULL; // standard DirectDraw 1.0
LPDIRECTDRAW lpdd4 = NULL; // DirectDraw 6.0 interface 4
int Game_Init(void *param = NULL, int num_param = 0)
{
// this is called once after the initial window is created and
// before the main event loop is entered, do all your initialization
// here
// first create the IDirectDraw interface
if(FAILED(DirectDrawCreate(NULL, &lpdd, NULL)))
{
//error
return (0);
}
// now query for IDirectDraw4
if(FAILED(lpdd->QueryInterface(IID_IDirectDraw4,
(LPVOID *)&lpdd4)))
{
//error
return (0);
}
//set cooperation to full screen
if(FAILED(lpdd4->SetCooperativeLevel(main_window_handle,
DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX |
DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
{
// error
return (0);
}
//set display mode to 640x480x8
if(FAILED(lpdd4->SetDisplayMode(SCREEN_WIDTH,
SCREEN_HEIGHT, SCREEN_BPP, 0, 0)))
{
// error
return (0);
}
// return success or failure or your own return code here
return (1);
}
结果编译报错:
error C2660: 'IDirectDraw::SetDisplayMode' : function does not take 5 arguments
求解!
