DirectX
变量声明 LPDIRECTDRAW7 m_pDD7;//声明DirectDraw对象
LPDIRECTDRAWSURFACE7 m_pPSur;//声明主绘图页
LPDIRECTDRAWSURFACE7 m_pBBuf;//声明后缓冲区
LPDIRECTDRAWSURFACE7 m_pOPla;//声明幕后暂存区
DDSCAPS2 m_caps;//声明DDSCAPS结构
DDSURFACEDESC2 m_desc;//声明描述结构体
初始化:
DirectDrawCreateEx(NULL,(VOID**)&m_pDD7,IID_IDirectDraw7,NULL);//建立DirectDraw对象
m_pDD7->SetCooperativeLevel(m_hWnd,DDSCL_ALLOWREBOOT|DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN);
m_pDD7->SetDisplayMode(m_screenX,m_screenY,16,0,DDSDM_STANDARDVGAMODE);
memset(&m_desc,0,sizeof(m_desc));
m_desc.dwSize=sizeof(m_desc);
m_desc.dwFlags=DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
m_desc.dwBackBufferCount=1;
m_desc.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE|DDSCAPS_COMPLEX|DDSCAPS_FLIP;
m_pDD7->CreateSurface(&m_desc,&m_pPSur,NULL); //执行到这出错 m_pPSur不能赋值
//??????????!!!!!!!!!!
m_caps.dwCaps=DDSCAPS_BACKBUFFER;
m_pPSur->GetAttachedSurface(&m_caps,&m_pBBuf);
memset(&m_desc,0,sizeof(m_desc));//建立幕后缓冲区
m_desc.dwSize=sizeof(m_desc);
m_desc.dwFlags=DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH;
m_desc.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN;
m_desc.dwWidth=m_screenX;
m_desc.dwHeight=m_screenY;
m_pDD7->CreateSurface(&m_desc,&m_pOPla,NULL);//建立幕后缓冲区