本文整理汇总了C++中LPDIRECTDRAWSURFACE::GetCaps方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE::GetCaps方法的具体用法?C++ LPDIRECTDRAWSURFACE::GetCaps怎么用?C++ LPDIRECTDRAWSURFACE::GetCaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTDRAWSURFACE
的用法示例。
在下文中一共展示了LPDIRECTDRAWSURFACE::GetCaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: q_initDD
void q_initDD()
{
if (initialized)
return;
DirectDrawCreate(NULL, &g_pDD, NULL);
HRESULT h;
h = g_pDD->SetCooperativeLevel(0, DDSCL_NORMAL);
if (h != DD_OK)
qDebug() << "cooperation level failed";
h = g_pDD->TestCooperativeLevel();
if (h != DD_OK)
qDebug() << "cooperation level failed test";
DDSURFACEDESC ddsd;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
h = g_pDD->CreateSurface(&ddsd, &g_pDDSSurface, NULL);
if (h != DD_OK)
qDebug() << "CreateSurface failed!";
if (g_pDDSSurface->GetCaps(&ddsCaps) != DD_OK)
qDebug() << "GetCaps failed";
q_lock();
q_unlock();
initialized = true;
}
示例2: InitFail
extern "C" HRESULT
InitDirectDraw(HWND hWnd, int w, int h, void* pixelData)
{
WNDCLASS wc;
DDSURFACEDESC ddsd;
HRESULT hRet;
hRet = DirectDrawCreate(NULL, &g_pDD, NULL);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, szDDrawFailedMsg);
// Get exclusive mode
hRet = g_pDD->SetCooperativeLevel(hWnd, DDSCL_FULLSCREEN); //DDSCL_NORMAL);//
if (hRet != DD_OK)
return InitFail(hWnd, hRet, szSetCooperativeFailMsg);
#if 0
DDCAPS ddCaps;
DDCAPS ddHelCaps;
g_pDD->GetCaps(&ddCaps, &ddHelCaps);
if (!(ddCaps.ddsCaps.dwCaps & DDSCAPS_BACKBUFFER))
{
return InitFail(hWnd, E_FAIL, szNoBackBufferMsg);
}
if (!(ddCaps.ddsCaps.dwCaps & DDSCAPS_FLIP))
{
return InitFail(hWnd, E_FAIL, szNoFlipSurfacesMsg);
}
#endif
// Create the primary surface with 1 back buffer
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS;// | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
//| DDSCAPS_FLIP;
//ddsd.dwBackBufferCount = 1;
hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL);
if (hRet != DD_OK)
{
return InitFail(hWnd, hRet, szCreateSurfaceFailMsg);
}
DWORD dwID;
g_hRefreshScreen = CreateEvent(NULL, FALSE, FALSE, NULL);
CreateThread(NULL, 0, ScreenRefresThread, NULL, 0, &dwID);
return DD_OK;
#if 0
#define WIDTH w // in pixels
#define HEIGHT h
#define DEPTH 2 // in bytes (2 bytes == 16 bits)
if (ddsd.dwBackBufferCount > 0) {
hRet = g_pDDSPrimary->EnumAttachedSurfaces(&g_pDDSBack, EnumFunction);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, szEnumAttachedSurfacesFailMsg);
}
ZeroMemory(&ddsd, sizeof(DDSURFACEDESC));
ZeroMemory(&ddsd.ddpfPixelFormat, sizeof(DDPIXELFORMAT));
ddsd.dwSize = sizeof(ddsd);
hRet = g_pDDSBack->Lock(NULL, &ddsd, DDLOCK_WAITNOTBUSY, NULL);
g_pDDSPrimary->Unlock(NULL);
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_LPSURFACE |
DDSD_PITCH | DDSD_PIXELFORMAT;
ddsd.dwWidth = WIDTH;
ddsd.dwHeight= HEIGHT;
//ddsd.lPitch = (LONG)DEPTH * WIDTH;
ddsd.lpSurface = pixelData;
/*
// Set up the pixel format for 24-bit RGB (8-8-8).
ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
ddsd.ddpfPixelFormat.dwFlags= DDPF_RGB;
ddsd.ddpfPixelFormat.dwRGBBitCount = (DWORD)DEPTH*8;
ddsd.ddpfPixelFormat.dwRBitMask = 0xF800;//surface->format->Rmask;
ddsd.ddpfPixelFormat.dwGBitMask = 0x07E0;//surface->format->Gmask;
ddsd.ddpfPixelFormat.dwBBitMask = 0x001F;//surface->format->Bmask;
//ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000;
//ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
//ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
*/
// Create the surface
hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSBack, NULL);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, szEnumAttachedSurfacesFailMsg);
return DD_OK;
#endif
if (ddsd.dwBackBufferCount > 0) {
hRet = g_pDDSPrimary->EnumAttachedSurfaces(&g_pDDSBack, EnumFunction);
if (hRet != DD_OK)
return InitFail(hWnd, hRet, szEnumAttachedSurfacesFailMsg);
}
return DD_OK;
//.........这里部分代码省略.........