当前位置: 首页>>代码示例>>C++>>正文


C++ LPDIRECTDRAWSURFACE::GetCaps方法代码示例

本文整理汇总了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;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:37,代码来源:ddhelper.cpp

示例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;
//.........这里部分代码省略.........
开发者ID:zeedh,项目名称:fastiva,代码行数:101,代码来源:lcd_dd..cpp


注:本文中的LPDIRECTDRAWSURFACE::GetCaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。