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


C++ LPDIRECTDRAWSURFACE4::Unlock方法代码示例

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


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

示例1: Clear_Surface

/***************************************************************************\
  Clears the specified surface.
\***************************************************************************/
void IMR_DirectXInterface::Clear_Surface(LPDIRECTDRAWSURFACE4 Surface)
{
HRESULT ddflag;
RECT Area;
DDSURFACEDESC2 DDSurfaceDesc;
char *Mem;

// Make sure the surface exists:
if (!Surface) return;

// Lock the surface:
DDSurfaceDesc.dwSize = sizeof(DDSurfaceDesc);
ddflag = Surface->Lock(&Area, &DDSurfaceDesc, DDLOCK_WAIT, NULL);
if (ddflag == DDERR_SURFACELOST)
    {
    Restore(Surface);
    ddflag = Surface->Lock(NULL, &DDSurfaceDesc, DDLOCK_WAIT, NULL);
     }
if (ddflag != DD_OK) return;
Mem = (char *)DDSurfaceDesc.lpSurface;

// Clear the surface:
if (Mem) memset(Mem, 0, DDSurfaceDesc.dwSize);

// And unlock the surface:
Surface->Unlock(NULL);
 }
开发者ID:dhawt,项目名称:Immerse,代码行数:30,代码来源:imr_directx.cpp

示例2: memset

//=====================================================================================
//	FillLMapSurface
//=====================================================================================
static void FillLMapSurface2(DRV_LInfo *LInfo, int32 LNum)
{
	U16					*pTempBits;
	int32				w, h, Width, Height, Stride;
	U8					*pBitPtr;
	RGB_LUT				*Lut;
	geRDriver_THandle	*THandle;
	HRESULT				Result;
	const RECT			*pRect;
    DDSURFACEDESC2		SurfDesc;
	LPDIRECTDRAWSURFACE4	Surface;
	int32				Extra;

	THandle = LInfo->THandle;

	pBitPtr = (U8*)LInfo->RGBLight[LNum];

	Width = LInfo->Width;
	Height = LInfo->Height;

	Lut = &AppInfo.Lut1;

    pRect = TPage_BlockGetRect(THandle->Block);
	Surface = TPage_BlockGetSurface(THandle->Block);

    memset(&SurfDesc, 0, sizeof(DDSURFACEDESC2));
    SurfDesc.dwSize = sizeof(DDSURFACEDESC2);

	Result = Surface->Lock((RECT*)pRect, &SurfDesc, DDLOCK_WAIT, NULL);

	assert(Result == DD_OK);

	Stride = SurfDesc.dwWidth;

	pTempBits = (U16*)SurfDesc.lpSurface;

	Extra = Stride - Width; 

	for (h=0; h< Height; h++)
	{
		for (w=0; w< Width; w++)
		{
			U8	R, G, B;
			U16	Color;
			R = *pBitPtr++;
			G = *pBitPtr++;
			B = *pBitPtr++;
			
			Color = (U16)(Lut->R[R] | Lut->G[G] | Lut->B[B]);

			*pTempBits++ = Color;
		}
		pTempBits += Extra;
	}

    Result = Surface->Unlock((RECT*)pRect);

	assert(Result == DD_OK);
}
开发者ID:RealityFactory,项目名称:Genesis3D,代码行数:62,代码来源:Pcache.cpp

示例3: LoadLMapFromSystem

//=====================================================================================
//	LoadLMapFromSystem
//=====================================================================================
static void LoadLMapFromSystem(DRV_LInfo *LInfo, int32 Log, int32 LNum)
{
	U16					*pTempBits;
	int32				w, h, Width, Height, Size, Extra;
	U8					*pBitPtr;
	LPDIRECTDRAWSURFACE4 Surface;
	RGB_LUT				*Lut;
    DDSURFACEDESC2		ddsd;
    HRESULT				ddrval;

	pBitPtr = (U8*)LInfo->RGBLight[LNum];

	Width = LInfo->Width;
	Height = LInfo->Height;
	Size = 1<<Log;

	Extra = Size - Width;

	Lut = &AppInfo.Lut1;

	Surface = SystemToVideo[Log].Surface;

    memset(&ddsd, 0, sizeof(DDSURFACEDESC2));
    ddsd.dwSize = sizeof(DDSURFACEDESC2);
    ddrval = Surface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);

	assert(ddrval == DD_OK);
	U8	R, G, B;
	U16	Color;

	pTempBits = (USHORT*)ddsd.lpSurface;

	for (h=0; h< Height; h++)
	{
		for (w=0; w< Width; w++)
		{
			R = *pBitPtr++;
			G = *pBitPtr++;
			B =  *pBitPtr++;
			
			Color = (U16)(Lut->R[R] | Lut->G[G] | Lut->B[B]);
			
			*pTempBits++ = Color;
		}
		pTempBits += Extra;
	}

    ddrval = Surface->Unlock(NULL);
	assert(ddrval == DD_OK);
}
开发者ID:RealityFactory,项目名称:Genesis3D,代码行数:53,代码来源:Pcache.cpp

示例4: Unlock_Surface

/***************************************************************************\
  Unlocks the specified surface.  
\***************************************************************************/
void IMR_DirectXInterface::Unlock_Surface(LPDIRECTDRAWSURFACE4 Surface)
{
if (!Surface) Surface = DDPrimarySurface;
Surface->Unlock(NULL);
}
开发者ID:dhawt,项目名称:Immerse,代码行数:8,代码来源:imr_directx.cpp

示例5: WinMain


//.........这里部分代码省略.........

		for ( j = 0; j < 1024; j++) {

			if ((colours[i][j] = colour_bmp_file.buffer[index++])>250) colours[i][j] = 250;
		
		
		}	

	fout << "\n";
	}

	LoadDEM();

	fout.close();

	LoadDEM();

	while (1) 
	{
		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
		{
			if(msg.message == WM_QUIT) { DD_Shutdown(); break; }
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		} 
		else 
		{	
			
			memset(&ddsd,0,sizeof(ddsd));
			ddsd.dwSize = sizeof(ddsd);


		



			
			while ( lpddsback->Lock(NULL,&ddsd,DDLOCK_SURFACEMEMORYPTR,NULL) != DD_OK);

				video_buffer = (UCHAR *) ddsd.lpSurface;

				memset(video_buffer,0,SCREEN_WIDTH*SCREEN_HEIGHT);


				GameMain();
			
				lpddsback->Unlock(NULL);
			
			

		sprintf(buffer,"%d",poo);
	

		if (lpddsback->GetDC(&hdc) == DD_OK) {
		 
			 SetBkColor(hdc, RGB(0, 0, 255));
			SetTextColor(hdc, RGB(255, 255, 0));
       
            TextOut(hdc, 0, 0, buffer, lstrlen(buffer));
           
		
        lpddsback->ReleaseDC(hdc);
		}

		
//Z+=10;
if (Z>3840.0) Z -=3840.0;

			while (TRUE)
               {
                   ddrval = lpddsprimary->Flip(NULL, 0);
                   if (ddrval == DD_OK)
					  
					   
                       break;
                   if (ddrval == DDERR_SURFACELOST)
                   {
                       ddrval = lpddsprimary->Restore();
                       if (ddrval != DD_OK)
                           break;
                   }
                   if (ddrval != DDERR_WASSTILLDRAWING)
                       break; 
			} 
			
            
			if (KEY_DOWN(VK_ESCAPE)) {
				
			DD_Shutdown();
			
				PostMessage(main_window_handle,WM_CLOSE,0,0);
			}
		} 
	}

	DD_Shutdown();

	return(msg.wParam);

}
开发者ID:cwilko,项目名称:voxelMap,代码行数:101,代码来源:version5.cpp


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