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


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

本文整理汇总了C++中LPDIRECTDRAWSURFACE::SetSurfaceDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTDRAWSURFACE::SetSurfaceDesc方法的具体用法?C++ LPDIRECTDRAWSURFACE::SetSurfaceDesc怎么用?C++ LPDIRECTDRAWSURFACE::SetSurfaceDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LPDIRECTDRAWSURFACE的用法示例。


在下文中一共展示了LPDIRECTDRAWSURFACE::SetSurfaceDesc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitFail


//.........这里部分代码省略.........
		if ( hRet != DD_OK ) {
			SetDDerror("DirectDraw2::CreateSurface", hRet);
			goto error_end;
		}
		hRet = g_pDDSBack->QueryInterface(
			&IID_IDirectDrawSurface3, (LPVOID *)&g_pDDSOne);
		g_pDDSBack->Release();
		if ( hRet != DD_OK ) {
			SetDDerror("DirectDrawSurface::QueryInterface", hRet);
			goto error_end;
		}
#endif
	}
#if 0
	if ( (flag & SDL_HWSURFACE) == SDL_HWSURFACE ) {
		/* Check to see whether the surface actually ended up
		   in video memory, and fail if not.  We expect the
		   surfaces we create here to actually be in hardware!
		*/
		hRet = g_pDDSOne->GetCaps(&ddsd.ddsCaps);
		if ( hRet != DD_OK ) {
			//SetDDerror("DirectDrawSurface3::GetCaps", hRet);
			goto error_end;
		}
		if ( (ddsd.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY) !=
							DDSCAPS_VIDEOMEMORY ) {
			//SDL_SetError("No room in video memory");
			goto error_end;
		}
	} else {
		/* Try to hook our surface memory */
		ddsd.dwFlags = DDSD_LPSURFACE;
		ddsd.lpSurface = pixelData;//surface->pixels;
		hRet = g_pDDSOne->SetSurfaceDesc(
								&ddsd, 0);
		if ( hRet != DD_OK ) {
			//SetDDerror("DirectDraw2::SetSurfaceDesc", hRet);
			goto error_end;
		}
	
	}

	/* Make sure the surface format was set properly */
	SDL_memset(&ddsd, 0, sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	hRet = IDirectDrawSurface3_Lock(g_pDDSOne, NULL,
		&ddsd, (DDLOCK_NOSYSLOCK|DDLOCK_WAIT), NULL);
	if ( hRet != DD_OK ) {
		//SetDDerror("DirectDrawSurface3::Lock", hRet);
		goto error_end;
	}
	IDirectDrawSurface3_Unlock(g_pDDSOne, NULL);

	if ( (flag & SDL_HWSURFACE) == SDL_SWSURFACE ) {
		if ( ddsd.lpSurface != surface->pixels ) {
			//SDL_SetError("DDraw didn't use SDL surface memory");
			goto error_end;
		}
		if (
#if defined(NONAMELESSUNION)
			ddsd.u1.lPitch
#else
			ddsd.lPitch
#endif
				 != (LONG)surface->pitch ) {
			//SDL_SetError("DDraw created surface with wrong pitch");
开发者ID:zeedh,项目名称:fastiva,代码行数:67,代码来源:lcd_dd..cpp


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