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


C++ LPDIRECTDRAW::Release方法代码示例

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


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

示例1: QueryVideoMemorySize

HRESULT CUtilGPU::QueryVideoMemorySize(DWORD dwCaps, DWORD* pdwTotalMem, DWORD* pdwFreeMem)
{
	LPDIRECTDRAW lpdd = NULL;
	HRESULT hr = DirectDrawCreate(NULL, &lpdd, NULL);
	if(SUCCEEDED(hr))
	{
		LPDIRECTDRAW7 lpdd7 = NULL;
		hr = lpdd->QueryInterface(IID_IDirectDraw7, (LPVOID*)&lpdd7);
		if(SUCCEEDED(hr))
		{
			DDSCAPS2 ddsCaps2;
			DWORD dwTotal=0, dwFree=0;
			// Initialize the structure.
			ZeroMemory(&ddsCaps2, sizeof(ddsCaps2));
			ddsCaps2.dwCaps = dwCaps;
			hr = lpdd7->GetAvailableVidMem(&ddsCaps2, &dwTotal, &dwFree);
			if(SUCCEEDED(hr))
			{
				if(pdwTotalMem)
					*pdwTotalMem =(dwTotal>>20); //rounded to MB
				if(pdwFreeMem)
					*pdwFreeMem = (dwFree>>20); //rounded to MB
			}
			lpdd7->Release();
		}
		lpdd->Release();
	}
	return hr;
}
开发者ID:szhuangzan,项目名称:2011Corel,代码行数:29,代码来源:UtilGPU.cpp

示例2: DDShutdown

void DDShutdown(void)
{
    // release clipper
    if (lpDDClipper) {
        lpDDClipper->Release();
        lpDDClipper = NULL;
    }
    
    // release the secondary surface
    if (lpDDSBack) {
        lpDDSBack->Release();
        lpDDSBack = NULL;
    }
    
    // release the primary surface
    if (lpDDSPrimary) {
        lpDDSPrimary->Release();
        lpDDSPrimary = NULL;
    }
    
    // finally, the main dd object
    if (lpDD) {
        lpDD->Release();
        lpDD = NULL;
    }
}
开发者ID:mreiferson,项目名称:dod,代码行数:26,代码来源:dodddraw.cpp

示例3: finiObjects

static void finiObjects(BOOL freeDD)
{
    if (!bActive)
    {
        return;
    }
    if (lpDD != NULL)
    {
        if (PrimarySurface != NULL)
        {
            PrimarySurface->Release();
            PrimarySurface = NULL;
        }
        if (BackSurface != NULL)
        {
            BackSurface->Release();
            BackSurface = NULL;
        }
        if (freeDD)
        {
            lpDD->Release();
            lpDD = NULL;
        }
    }
}
开发者ID:Almamu,项目名称:homeworld,代码行数:25,代码来源:draw.cpp

示例4:

static void
ReleaseAllObjects(void)
{
    if (g_pDDSBack != NULL)
    {
        g_pDDSBack->Release();
        g_pDDSBack = NULL;
    }
    if (g_pDDSPrimary != NULL)
    {
        g_pDDSPrimary->Release();
        g_pDDSPrimary = NULL;
    }
    if (g_pDDSOne != NULL)
    {
        g_pDDSOne->Release();
        g_pDDSOne = NULL;
    }
    if (g_pDDSTwo != NULL)
    {
        g_pDDSTwo->Release();
        g_pDDSTwo = NULL;
    }
    if (g_pDD != NULL)
    {
        g_pDD->Release();
        g_pDD = NULL;
    }
}
开发者ID:zeedh,项目名称:fastiva,代码行数:29,代码来源:lcd_dd..cpp

示例5: DDEnumDevCallback

BOOL WINAPI DDEnumDevCallback(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm)
{
	LPDIRECTDRAW ddp;
	LPDIRECTDRAW4 dd4p;
	DDDEVICEIDENTIFIER ddDev;
	BOOL ret = FALSE;

	if (DirectDrawCreate(lpGUID,&ddp,0) == DD_OK)
	{
		if(ddp->QueryInterface(IID_IDirectDraw4,(void **)&dd4p) == S_OK)
		{
			ZeroMemory(&ddDev,sizeof(ddDev));
			if(GetDeviceIdentifierEx(dd4p,&ddDev, DDGDI_GETHOSTIDENTIFIER) == DD_OK)
			{
				// add to table
				USES_CONVERSION;
				CUtilGPU::AddDisplayDevice(A2CT(lpDriverName), ddDev.dwVendorId, ddDev.dwDeviceId, ddDev.szDescription, ddDev.szDriver);
				ret = TRUE;
			}
			dd4p->Release();
		}
		ddp->Release();
	}

	return ret;
}
开发者ID:szhuangzan,项目名称:2011Corel,代码行数:26,代码来源:UtilGPU.cpp

示例6: InitDirectDraw

HRESULT DDVideo::InitDirectDraw()
{
	DDSURFACEDESC2 ddsd;
    DDSCAPS2 ddscaps;
	HRESULT		hRet;
 
    //Create the main DirectDraw object - updated to do it the hard way.... 7/10
    LPDIRECTDRAW pDD;

	HINSTANCE hInstDDraw;
    LPDIRECTDRAWCREATE pDDCreate = NULL;
    hInstDDraw = LoadLibrary("ddraw.dll");
	pDDCreate = ( LPDIRECTDRAWCREATE )GetProcAddress( hInstDDraw, "DirectDrawCreate" );
    pDDCreate( NULL, &pDD, NULL );
	//hRet = DirectDrawCreate(NULL,&pDD, NULL);

    hRet = pDD->QueryInterface(IID_IDirectDraw7, (LPVOID *) & m_lpDD);
      
	//Set cooperative level
	if (m_bWindowed) { //#112
		m_lpDD->SetCooperativeLevel(m_hWnd, DDSCL_ALLOWREBOOT | DDSCL_NORMAL | DDSCL_MULTITHREADED);
	} else {
		hRet = m_lpDD->SetCooperativeLevel(m_hWnd,DDSCL_EXCLUSIVE |DDSCL_ALLOWREBOOT| DDSCL_ALLOWMODEX | DDSCL_FULLSCREEN | DDSCL_MULTITHREADED);
		m_lpDD->SetDisplayMode(800,600,16,g_DX9Settings.m_refreshrate,0);
	}
	
	ZeroMemory(&ddsd, sizeof(ddsd));
	ddsd.dwSize = sizeof(ddsd);
	
	//#112
	ddsd.dwFlags = (m_bWindowed) ? DDSD_CAPS : DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
	ddsd.ddsCaps.dwCaps = (m_bWindowed) ? DDSCAPS_PRIMARYSURFACE : DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;

	if (m_bWindowed) {
		LPDIRECTDRAWCLIPPER lpClipper;
		hRet = m_lpDD->CreateSurface(&ddsd, &m_lpDDSPrimary, NULL);
		hRet = m_lpDD->CreateClipper( 0, &lpClipper, NULL );
		hRet = lpClipper->SetHWnd( 0, m_hWnd );
		hRet = m_lpDDSPrimary->SetClipper( lpClipper );
		ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
		ddsd.dwWidth = 800;
		ddsd.dwHeight = 600;
		hRet = m_lpDD->CreateSurface(&ddsd, &m_lpDDSBack, NULL);
	} else {
		ddsd.dwBackBufferCount = 1;
		hRet = m_lpDD->CreateSurface(&ddsd, &m_lpDDSPrimary, NULL);
		ZeroMemory( &ddscaps, sizeof( ddscaps ) );
		ddscaps.dwCaps=DDSCAPS_BACKBUFFER;
		hRet = m_lpDDSPrimary->GetAttachedSurface(&ddscaps,&m_lpDDSBack);
	}

	pDD->Release();
	return hRet;
}
开发者ID:FreeAllegiance,项目名称:Allegiance-R7-With-R4-Engine,代码行数:55,代码来源:ddvideo.cpp

示例7:

	~WSurfaceData() {
		if (clipper) clipper->Release();
		if (LeftBuffer) ((LPDIRECTDRAWSURFACE)LeftBuffer)->Release();
		if (RightBuffer) ((LPDIRECTDRAWSURFACE)RightBuffer)->Release();
		if (screen) screen->Release();
		if (ddraw) {
			if (!window_mode)
				ddraw->RestoreDisplayMode();
			ddraw->Release();
		}
		LeftBuffer=RightBuffer=0;
		ddraw=0,screen=0;
	}
开发者ID:eastany,项目名称:eastany.github.com,代码行数:13,代码来源:wsurface.cpp

示例8: ReleaseAllObjects

//-----------------------------------------------------------------------------
// Name: ReleaseAllObjects()
// Desc: Finished with all objects we use; release them
//-----------------------------------------------------------------------------
static void ReleaseAllObjects(void)
{
	if (g_pDDSPrimary != NULL)
	{
		g_pDDSPrimary->Release();
		g_pDDSPrimary = NULL;
	}

	if (g_pDD != NULL)
	{
		g_pDD->Release();
		g_pDD = NULL;
	}
}
开发者ID:HITEG,项目名称:TenByTen6410_SLC,代码行数:18,代码来源:mfc_render.cpp

示例9: Shutdown

//------------------------------------------------------------
// Name: ShutDown
// Desc: Clean up everything.
//------------------------------------------------------------
int Shutdown()
{
	// this function is where you shutdown your game and
	// release all resources that you allocated

	// first release the primary surface
	if (lpddsprimary != NULL)
		lpddsprimary->Release();
       
	// release the directdraw object
	if (lpdd != NULL)
		lpdd->Release();

	// return success
	return(1);
} // end Shutdown
开发者ID:scirelli,项目名称:testForDX5,代码行数:20,代码来源:WinMain.cpp

示例10: CreateD3D

// Direct3D 생성
BOOL CreateD3D()
{
    // DirectDraw 인터페이스 생성
    LPDIRECTDRAW lpdd;

    // 설정된 DirectDraw Device
    HRESULT hresult = DirectDrawCreate( NULL, &lpdd, NULL );
    if ( hresult != DD_OK )
	{
		MESSAGE( "DirectDrawCreate" );
        return FALSE;
	}

    // DirectDraw2 인터페이스 얻기
    hresult = lpdd->QueryInterface( IID_IDirectDraw4, (LPVOID*)&lpDD );
    if ( hresult != DD_OK )
	{
		MESSAGE( "lpdd->QueryInterface" );
        return FALSE;
	}

    // DirectDraw 인터페이스 제거
    lpdd->Release();


    // Direct3D 인터페이스 얻기
    hresult = lpDD->QueryInterface( IID_IDirect3D3, (LPVOID*)&lpD3D );
    if ( hresult != DD_OK )
	{
		MESSAGE( "lpDD3->QueryInterface" );
        return FALSE;
	}

    // Direct3D Device 인터페이스 얻기
	hresult = lpD3D->EnumDevices( DeviceEnumCallback, (LPVOID)&lpDeviceDesc );
    if ( hresult != DD_OK )
	{
		MESSAGE( "lpD3D->EnumDevices" );
        return FALSE;
	}

	lpD3DDeviceDesc = FindBestDevice( lpDeviceDesc );
	if ( !lpD3DDeviceDesc )
		return FALSE;

    return TRUE;
}
开发者ID:rafaellincoln,项目名称:Source-Priston-Tale,代码行数:48,代码来源:smDsx.cpp

示例11: CleanupGraphics

//-----------------------------------------------------------------------------
// Name: CleanupGraphics()
// Desc:
//-----------------------------------------------------------------------------
VOID CleanupGraphics()
{
    for( DWORD i=0; i<4; i++ )
        if( g_pddsShip[i] )
            g_pddsShip[i]->Release();
    if( g_pddsNumbers )
        g_pddsNumbers->Release();
    if( g_pddsFrontBuffer )
        g_pddsFrontBuffer->Release();
    if( g_pArtPalette )
        g_pArtPalette->Release();
    if( g_pSplashPalette )
        g_pSplashPalette->Release();
    if( !g_bFullscreen && g_pddsBackBuffer )
        g_pddsBackBuffer->Release();
    if( g_pDD )
        g_pDD->Release();
}
开发者ID:grakidov,项目名称:Render3D,代码行数:22,代码来源:gfx.cpp

示例12: FreeDDraw

void FreeDDraw()
{
	if(lpDD != NULL)
	{
		if(lpDDSPrimary != NULL)
		{
			lpDDSPrimary->Release();
			lpDDSPrimary = NULL;
		}
		if(lpDDSTemp != NULL)
		{
			lpDDSTemp->Release ();
			lpDDSTemp = NULL;
		}
		lpDD->Release ();
		lpDD = NULL;
	}
	return;
}
开发者ID:jollywing,项目名称:jolly-code-snippets,代码行数:19,代码来源:init_ddraw.cpp

示例13: init_DirectDraw

static void init_DirectDraw() {
    /**
     * Note: if DirectDraw fails to initialize, we will use GDI to
     *  draw to do the screenBuffer->LCD copying.
     */
    HRESULT hRet;
    hRet = DirectDrawCreate(NULL, &g_pDD, NULL);
    if (hRet != DD_OK) {
        return;
    }

    hRet = g_pDD->SetCooperativeLevel(hwndMain, DDSCL_NORMAL);
    if (hRet != DD_OK) {
        g_pDD->Release();
        g_pDD = NULL;
        return;
    }

    wince_init_fonts();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:20,代码来源:winceapp_export.cpp

示例14: _ReleaseAll

void _ReleaseAll( void )
{
    if ( DirectOBJ != NULL )
    {
        if ( RealScreen != NULL )
        {
            RealScreen->Release();
            RealScreen = NULL;
        }
        if ( SpriteImage != NULL )
        {
            SpriteImage->Release();
            SpriteImage = NULL;
        }
        if ( BackGround != NULL )
        {
            BackGround->Release();
            BackGround = NULL;
        }
        DirectOBJ->Release();
        DirectOBJ = NULL;
    }
}
开发者ID:Redrock912,项目名称:reboot,代码行数:23,代码来源:spriteSound.cpp

示例15: DD_CreateSurfaces

void DD_CreateSurfaces(int w, int h, int fsh, int fs, int fsbpp, int flip, int dbl, int fsovl) // fsh is the height to use (not screen res)
{
  int resize_h=8, resize_w=8;
#ifdef RESIZE_ONRESIZE
  int fb_save[64*65+1];
  int fb_save_use=0;
#endif
  EnterCriticalSection(&g_cs);
  nodraw=0;
  if (g_lpDD)
  {
    extern int config_reuseonresize;
#ifdef RESIZE_ONRESIZE
    HRESULT han;
    int ll=!!last_used;
    DDSURFACEDESC d={sizeof(d),};
  	if (config_reuseonresize && g_w && g_h && g_lpRenderSurf[ll] &&
        (han = g_lpRenderSurf[ll]->Lock(NULL,&d,DDLOCK_WAIT,NULL)) == DD_OK) 
    {
      if (d.lpSurface)
      {
        int x,y;
        int dxpos=(g_w<<16)/64;
        int ypos=0;
        int dypos=(g_h<<16)/64;
        int *pp=((int *)d.lpSurface);

        if (g_fs && g_fs_height < g_h) // adjust to use partial screen when 
        {
          int fsy=g_h/2-g_fs_height/2;
          dypos=(g_fs_height<<16)/64;
          pp+=fsy * g_w;
        }

        for (y = 0; y < 64; y++)
        {
          int *p=pp + g_w * (ypos>>16);
          int xpos=0;
          for (x = 0; x < 64; x ++)
          {
            fb_save[(y<<6)+x]=p[xpos>>16];
            xpos+=dxpos;
          }
          ypos+=dypos;
        }
        memset(fb_save+64*64,0,sizeof(int)*65);
        fb_save_use=1;
      }
      g_lpRenderSurf[ll]->Unlock(d.lpSurface);
    }
#endif

		if (g_lpPrimSurf)
		{
			g_lpPrimSurf->Release();
			g_lpPrimSurfBack=g_lpPrimSurf=NULL;
		}
    if (g_lpRenderSurf[0]) g_lpRenderSurf[0]->Release();
    if (g_lpRenderSurf[1]) g_lpRenderSurf[1]->Release();
    g_lpRenderSurf[0]=0;
    g_lpRenderSurf[1]=0;
    if (g_lpddsOverlay) g_lpddsOverlay->Release();
    if (g_lpddsPrimary) g_lpddsPrimary->Release();
    g_lpddsOverlay=g_lpddsPrimary=NULL;
    g_lpDD->Release();
    g_lpDD=NULL;
  }
开发者ID:Denyufka,项目名称:LibVisual,代码行数:67,代码来源:draw.cpp


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