我用direct 9 SDK开发游戏,但遇到下面的问题:
BOOL csufaace::Create(int nWidth,int nHeight,COLORREF Keyvalue)
{
HRESULT ret;
LPDIRECTDRAW lpdd;
LPDIRECTDRAW7 m_pdd;
LPDIRECTDRAWSURFACE7 m_surface;
DDSURFACEDESC2 ddsd;
DDCOLORKEY ddck;
ZeroMemory(&ddsd,sizeof(ddsd));
ddsd.dwSize=sizeof(ddsd);
ddsd.dwFlags=DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH;
ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY;
ddsd.dwWidth=nWidth;
ddsd.dwHeight=nHeight;
ret=DirectDrawCreate(NULL,&lpdd,NULL);
if(ret!=DD_OK)
{MessageBox(NULL,"DirectDraw Create Failed0!","hellow",MB_OK);
return FALSE;}
ret=lpdd->QueryInterface(IID_IDirectDraw7,(LPVOID*)&m_pdd);
if(ret!=DD_OK)
{MessageBox(NULL,"DirectDraw7 Create Failed1!","hellow",MB_OK);
return FALSE;}
lpdd->Release();
ret=m_pdd->CreateSurface(&ddsd,&m_surface,NULL);
if(ret!=DD_OK)
{MessageBox(NULL,"DirectDraw7 Surface Create Failed2!","hellow",MB_OK);
return FALSE;}
return 1;
}
但是总是弹出对话框 "DirectDraw7 Surface Create Failed2";
高手能帮我指点一下迷津吗?谢谢!!!!
--------------------next---------------------
阅读(1205) | 评论(0) | 转发(0) |