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


C++ LPDIRECTDRAW7类代码示例

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


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

示例1: DDEnumCallbackEx

//-----------------------------------------------------------------------------
// Name: DDEnumCallbackEx()
// Desc: This callback gets the information for each device enumerated
//-----------------------------------------------------------------------------
BOOL WINAPI DDEnumCallbackEx( GUID *pGUID, LPSTR pDescription, LPSTR strName,
                              LPVOID pContext, HMONITOR hm )
{
    LPDIRECTDRAW7 pDD = NULL;	
    HRESULT hr;

    // Create a DirectDraw object using the enumerated GUID
    if( FAILED( hr = DirectDrawCreateEx( pGUID, (VOID**)&pDD, 
                                         IID_IDirectDraw7, NULL ) ) )
        return DDENUMRET_CANCEL;

    // Get the device information and save it
    pDD->GetDeviceIdentifier( &g_DeviceIdent[g_iMaxDevices].DeviceInfo, 0 );
    pDD->GetDeviceIdentifier( &g_DeviceIdent[g_iMaxDevices].DeviceInfoHost, 
                              DDGDI_GETHOSTIDENTIFIER );

    // Finished with the DirectDraw object, so release it
    SAFE_RELEASE( pDD ); 

    // Bump to the next open slot or finish the callbacks if full
    if( g_iMaxDevices < MAX_DEVICES )
        g_iMaxDevices++;
    else
        return DDENUMRET_CANCEL;

    return DDENUMRET_OK;
}
开发者ID:grakidov,项目名称:Render3D,代码行数:31,代码来源:ddenum.cpp

示例2: DDEnumCallback

BOOL WINAPI DDEnumCallback( GUID *pGUID, LPSTR pDescription, LPSTR strName,
                              LPVOID pContext )
{
	LPDIRECTDRAW7 pDD = NULL;	
	HRESULT hr;

	
	if( FAILED( hr = DirectDrawCreateEx( pGUID, (VOID**)&pDD, 
										 IID_IDirectDraw7, NULL ) ) )
		return DDENUMRET_CANCEL;

	
	pDD->GetDeviceIdentifier( &DeviceInfo[g_iMaxDevices], 0 );


	
	if(pDD) {
		pDD->Release();
		pDD = NULL;
	}

	
	if( g_iMaxDevices < MAX_DEVICES )
		g_iMaxDevices++;
	else
		return DDENUMRET_CANCEL;

	return DDENUMRET_OK;
}
开发者ID:0xrofi,项目名称:Aquaplus,代码行数:29,代码来源:Enum.cpp

示例3: RELEASE

/*****************************Private*Routine******************************\
* OnSetDDrawDevice
*
\**************************************************************************/
HRESULT
CMpegMovie::OnSetDDrawDevice(
    LPDIRECTDRAW7 pDD,
    HMONITOR hMon
    )
{
    HRESULT hr = S_OK;

    RELEASE(m_pddsRenderT);
    RELEASE(m_pddsPriText);
    RELEASE(m_pddsPrimary);

    __try
    {

        DDSURFACEDESC2 ddsd;  // A surface description structure
        INITDDSTRUCT(ddsd);
        ddsd.dwFlags = DDSD_CAPS;
        ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

        CHECK_HR(hr = pDD->EnumSurfaces(DDENUMSURFACES_DOESEXIST |
            DDENUMSURFACES_ALL,
            &ddsd,
            &m_pddsPrimary,
            DDSurfEnumFunc));
        if(!m_pddsPrimary)
        {
            hr = E_FAIL;
            __leave;
        }

        MONITORINFOEX miInfoEx;
        miInfoEx.cbSize = sizeof(miInfoEx);
        GetMonitorInfo(hMon, &miInfoEx);

        INITDDSTRUCT(ddsd);
        ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
        ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
        ddsd.dwWidth = (miInfoEx.rcMonitor.right - miInfoEx.rcMonitor.left);
        ddsd.dwHeight = (miInfoEx.rcMonitor.bottom - miInfoEx.rcMonitor.top);

        CHECK_HR(hr = pDD->CreateSurface(&ddsd, &m_pddsPriText, NULL));
        CHECK_HR(hr = pDD->CreateSurface(&ddsd, &m_pddsRenderT, NULL));

    }
    __finally
    {
        if(FAILED(hr))
        {
            RELEASE(m_pddsRenderT);
            RELEASE(m_pddsPriText);
            RELEASE(m_pddsPrimary);
        }
    }

    return hr;
}
开发者ID:grakidov,项目名称:Render3D,代码行数:61,代码来源:AllocPresenter.cpp

示例4: jcdd_createOffscreenSurface

	BOOL jcdd_createOffscreenSurface(
		LPDIRECTDRAW7 lpdd, LPDIRECTDRAWSURFACE7* lplpdds, INT width, INT height, UINT colorKey, BOOL useColorKey)
	{
		if(lpdd == NULL)
		{
			return FALSE;
		}

		DDSURFACEDESC2 ddsd;
		jcdd_initStruct(&ddsd);
		ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
		ddsd.dwWidth = width;
		ddsd.dwHeight = height;
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
		if(FAILED(lpdd->CreateSurface(&ddsd, lplpdds, NULL)))
		{
			return FALSE;
		}

		if(useColorKey)
		{
			DDCOLORKEY ck;
			ck.dwColorSpaceHighValue = colorKey;
			ck.dwColorSpaceLowValue = colorKey;
			if(FAILED((*lplpdds)->SetColorKey(DDCKEY_SRCBLT, &ck)))
			{
				return FALSE;
			}
		}

		return TRUE;
	}
开发者ID:chengkehan,项目名称:lab,代码行数:32,代码来源:JCDD_Util.cpp

示例5: vdraw_ddraw_set_cooperative_level

/**
 * vdraw_ddraw_set_cooperative_level(): Sets the DirectDraw cooperative level.
 * @return 0 on success; non-zero on error.
 */
int WINAPI vdraw_ddraw_set_cooperative_level(void)
{
	if (!gens_window || !lpDD)
		return -1;
	
	HRESULT rval;
#ifdef DISABLE_EXCLUSIVE_FULLSCREEN_LOCK
	Video.VSync_FS = 0;
	rval = lpDD->SetCooperativeLevel(gens_window, DDSCL_NORMAL);
#else
	if (vdraw_get_fullscreen())
		rval = lpDD->SetCooperativeLevel(gens_window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
	else
		rval = lpDD->SetCooperativeLevel(gens_window, DDSCL_NORMAL);
#endif
	
	if (FAILED(rval))
	{
		LOG_MSG(video, LOG_MSG_LEVEL_WARNING,
			"lpDD->SetCooperativeLevel() failed.");
		// TODO: Error handling code.
	}
	else
	{
		LOG_MSG(video, LOG_MSG_LEVEL_INFO,
			"lpDD->SetCooperativeLevel() succeeded.");
	}
	
	return 0;
}
开发者ID:PhilrocWP,项目名称:gens,代码行数:34,代码来源:vdraw_ddraw.cpp

示例6: Game_Init

int Game_Init(void *parms = NULL, int num_parms = 0)
{
// this is called once after the initial window is created and
// before the main event loop is entered, do all your initialization
// here

// create IDirectDraw interface 7.0 object and test for error
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
   return(0);

// set cooperation to full screen
if (FAILED(lpdd->SetCooperativeLevel(main_window_handle, 
                                      DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | 
                                      DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
   {
   // error
   return(0);
   } // end if

// set display mode to 640x480x8
if (FAILED(lpdd->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,0,0)))
   {
   // error
   return(0);
   } // end if


// return success or failure or your own return code here
return(1);

} // end Game_Init
开发者ID:chenyingjing,项目名称:GameProgrammingDemo,代码行数:31,代码来源:demo6_2.cpp

示例7: DD_Shutdown

int DD_Shutdown(void)
{
// this function release all the resources directdraw
// allocated, mainly to com objects

// release the clipper first
if (lpddclipper)
    lpddclipper->Release();

// release the palette
if (lpddpal)
   lpddpal->Release();

// release the secondary surface
if (lpddsback)
    lpddsback->Release();

// release the primary surface
if (lpddsprimary)
   lpddsprimary->Release();

// finally, the main dd object
if (lpdd)
    lpdd->Release();

// return success
return(1);
} // end DD_Shutdown
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:28,代码来源:blackbox.cpp

示例8: cleanup

void DirectDrawDisplay::cleanup()
{
  if(pDirectDraw != NULL) {
    if(ddsClipper != NULL) {
      ddsClipper->Release();
      ddsClipper = NULL;
    }

    if(ddsFlip != NULL) {
      ddsFlip->Release();
      ddsFlip = NULL;
    }

    if(ddsOffscreen != NULL) {
      ddsOffscreen->Release();
      ddsOffscreen = NULL;
    }
    
    if(ddsPrimary != NULL) {
      ddsPrimary->Release();
      ddsPrimary = NULL;
    }
    
    pDirectDraw->Release();
    pDirectDraw = NULL;
  }

  if(ddrawDLL != NULL) {
    AfxFreeLibrary(ddrawDLL);
    ddrawDLL = NULL;
  }
  width = 0;
  height = 0;
}
开发者ID:oydang,项目名称:CS4701-pokemon-AI,代码行数:34,代码来源:DirectDraw.cpp

示例9: Game_Shutdown

int Game_Shutdown(void *parms = NULL, int num_parms = 0)
{
// this is called after the game is exited and the main event
// loop while is exited, do all you cleanup and shutdown here

// kill all the surfaces


// first the palette
if (lpddpal)
   {
   lpddpal->Release();
   lpddpal = NULL;
   } // end if

// now the primary surface
if (lpddsprimary)
   {
   lpddsprimary->Release();
   lpddsprimary = NULL;
   } // end if

// now blow away the IDirectDraw4 interface
if (lpdd)
   {
   lpdd->Release();
   lpdd = NULL;
   } // end if

// return success or failure or your own return code here
return(1);

} // end Game_Shutdown
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:33,代码来源:demo7_14.cpp

示例10: dx_Restaure

//-----------------------------------------------------------------------------
// Name: dx_Restaure()
// Desc: Restaure les objets perdus (s'ils sont perdus)
//-----------------------------------------------------------------------------
void dx_Restaure ()
{
    if (SurfacePrimaire->IsLost () != DD_OK)
    {
        DirectDraw7->RestoreAllSurfaces ();
        (*Restaure)();
    }
}
开发者ID:hlemorvan,项目名称:vision-stereo,代码行数:12,代码来源:DirectDraw.cpp

示例11: InitDirectDraw

int InitDirectDraw()
{
   DDSURFACEDESC2 ddsd;
   DDSCAPS2       ddscaps;
   HRESULT		  hRet;

   // Create the main DirectDraw object.
   hRet = DirectDrawCreateEx(NULL, (VOID**)&g_pDD, IID_IDirectDraw7, NULL);
   if( hRet != DD_OK )
       return -1;

   // Get exclusive mode.
   hRet = g_pDD->SetCooperativeLevel(g_hMainWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
   if( hRet != DD_OK )
       return -2;

   // Set the video mode to 640x480x16.
   hRet = g_pDD->SetDisplayMode(640, 480, 16, 0, 0);
   if( hRet != DD_OK )
       return -3;

   // Prepare to create the primary surface by initializing
   // the fields of a DDSURFACEDESC2 structure.
   ZeroMemory(&ddsd, sizeof(ddsd));
   ddsd.dwSize = sizeof(ddsd);
   ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
   ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP |
      DDSCAPS_COMPLEX;
   ddsd.dwBackBufferCount = 1;

   // Create the primary surface.
   hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSFront, NULL);
   if( hRet != DD_OK )
       return -1;

   // Get a pointer to the back buffer.
   ZeroMemory(&ddscaps, sizeof(ddscaps));
   ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
   hRet = g_pDDSFront->GetAttachedSurface(&ddscaps, &g_pDDSBack);
   if( hRet != DD_OK )
       return -1;

   return 0;

} 
开发者ID:ellysh,项目名称:ddraw-mingw,代码行数:45,代码来源:BasicDD.cpp

示例12: DDOverlayInit

//! Setup the overlay object
bool DDOverlayInit()
{
    // Get hardware's CAPabilitieS
    memset(&g_DDCaps, 0, sizeof(g_DDCaps));
    g_DDCaps.dwSize = sizeof(g_DDCaps);
    if (g_pDD->GetCaps(&g_DDCaps, 0))
        return DisplayError("Can't get capabilities");

    // Make sure it supports overlays
    if (!(g_DDCaps.dwCaps & DDCAPS_OVERLAY))
        return DisplayError("Hardware doesn't support overlays");

    //DO NOT Make sure it supports stretching (scaling)
    //if (!(g_DDCaps.dwCaps & DDCAPS_OVERLAYSTRETCH)) return false;

    DDSURFACEDESC2              ddsd;  // DirectDraw surface descriptor
    HRESULT                     hRet;  // I'm not even going to try...
    // The pixel formats that we want the surface to be in
    DDPIXELFORMAT               ddpfOverlayFormats[] = {
        {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0xFF0000, 0x0FF00, 0x0000FF, 0}, // 32-bit RGB
        {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x007C00, 0x003e0, 0x00001F, 0}, // 16-bit RGB 5:5:5
        {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x00F800, 0x007e0, 0x00001F, 0}, // 16-bit RGB 5:6:5
        {sizeof(DDPIXELFORMAT), DDPF_FOURCC, mmioFOURCC('U','Y','V','Y'), 16, 0, 0, 0, 0}, // UYVY
        {sizeof(DDPIXELFORMAT), DDPF_FOURCC, mmioFOURCC('Y','4','2','2'), 16, 0, 0, 0, 0}, // the same as UYVY
        {sizeof(DDPIXELFORMAT), DDPF_FOURCC, mmioFOURCC('Y','U','Y','2'), 16, 0, 0, 0, 0}, // YUY2 is unsupported color-space here
        {0}};

    // Setup the overlay surface's attributes in the surface descriptor
    memset(&ddsd, 0, sizeof(ddsd));
    ddsd.dwSize = sizeof(ddsd);
    ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | g_DDCaps.ddsCaps.dwCaps&DDSCAPS_VIDEOMEMORY;
    ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
    ddsd.dwBackBufferCount = 0;
    ddsd.dwWidth = g_sizex;
    ddsd.dwHeight = g_sizey;
    for(int format = 0; ddpfOverlayFormats[format].dwSize; format++) {
        ddsd.ddpfPixelFormat = ddpfOverlayFormats[format];
        // Attempt to create the surface with theses settings
        hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSOverlay, NULL);
        if(hRet == DD_OK) break;
    }
    if (hRet != DD_OK)
        return DisplayError("Can't create appropriate overlay surface", hRet);
    return true;
}
开发者ID:ucberkeley,项目名称:lithe,代码行数:46,代码来源:ddvideo.cpp

示例13: CreateSurface

//-----------------------------------------------------------------------------
// Name: CreateSurface()
// Desc: creates a offscreen plain surface
//-----------------------------------------------------------------------------
LPDIRECTDRAWSURFACE7 CreateSurface(int width, int height, SCCOLOR TransparentColor)
{// this function creates an offscreen plain surface

	//DDSURFACEDESC2 ddsd;         // working description
	LPDIRECTDRAWSURFACE7 lpdds;  // temporary surface
    
	// set to access caps, width, and height
	memset(&ddsd,0,sizeof(ddsd));
	ddsd.dwSize  = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;

	// set dimensions of the new bitmap surface
	ddsd.dwWidth  =  width;
	ddsd.dwHeight =  height;

	// set surface to offscreen plain
	ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;//default is video memory VRAM
	
	// create the surface
	ddReturnVal  = lpddObj->CreateSurface(&ddsd,&lpdds,NULL);
	if(ddReturnVal == DDERR_OUTOFVIDEOMEMORY)//out of vram
	{
		// set surface to offscreen plain system memory
		ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
		ddReturnVal  = lpddObj->CreateSurface(&ddsd,&lpdds,NULL);
	}
	if (DDFailedCheck(ddReturnVal, "CreateSurface() failed", cpErrorBuf ))//DDERR_OUTOFVIDEOMEMORY DDSCAPS_SYSTEMMEMORY
	{	MessageBox(main_window_handle, cpErrorBuf, "CreateSurface()", MB_ICONEXCLAMATION);   return(NULL); }
	
	// set color key to TransparentColor
	DDCOLORKEY color_key; // used to set color key
	color_key.dwColorSpaceLowValue  = BIULDCOLOR(TransparentColor.r,TransparentColor.g,TransparentColor.b);
	color_key.dwColorSpaceHighValue = BIULDCOLOR(TransparentColor.r,TransparentColor.g,TransparentColor.b);

	// now set the color key for source blitting
	ddReturnVal  = lpdds->SetColorKey(DDCKEY_SRCBLT, &color_key);
	if (DDFailedCheck(ddReturnVal, "SetColorKey() failed", cpErrorBuf ))
	{	MessageBox(main_window_handle, cpErrorBuf, "CreateSurface()", MB_ICONEXCLAMATION);   return(NULL); }

	// return surface
	return(lpdds);

} // end CreateSurface()
开发者ID:scirelli,项目名称:testForDX7,代码行数:47,代码来源:SurfaceFuncs.cpp

示例14: Game_Init

int Game_Init(void *parms = NULL, int num_parms = 0)
{
// this is called once after the initial window is created and
// before the main event loop is entered, do all your initialization
// here

// create IDirectDraw interface 7.0 object and test for error
if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))
   return(0);

// set cooperation to full screen
if (FAILED(lpdd->SetCooperativeLevel(main_window_handle, 
                                      DDSCL_FULLSCREEN | DDSCL_ALLOWMODEX | 
                                      DDSCL_EXCLUSIVE | DDSCL_ALLOWREBOOT)))
   return(0);

// set display mode to 640x480x8
if (FAILED(lpdd->SetDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP,0,0)))
   return(0);

// clear ddsd and set size
DDRAW_INIT_STRUCT(ddsd); 

// enable valid fields
ddsd.dwFlags = DDSD_CAPS;

// request primary surface
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

// create the primary surface
if (FAILED(lpdd->CreateSurface(&ddsd, &lpddsprimary, NULL)))
   return(0);

// load the 24-bit image
if (!Load_Bitmap_File(&bitmap,"bitmap24.bmp"))
   return(0);


// return success or failure or your own return code here
return(1);

} // end Game_Init
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:42,代码来源:demo7_11.cpp

示例15: ShutDown

//-----------------------------------------------------------------------------
// Name: ShutDown()
// Desc: cleans up evreything. releases mem used
//-----------------------------------------------------------------------------
int ShutDown()
{
	// now release the primary surface
	if (lpddsPrimary!=NULL)
		lpddsPrimary->Release();
       
	// release the directdraw object
	if (lpddObj!=NULL)
		lpddObj->Release();

	return(1);
}
开发者ID:scirelli,项目名称:testForDX7,代码行数:16,代码来源:WinMain.cpp


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