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


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

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


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

示例1: rglDDrawActivate

extern "C" DLL void rglDDrawActivate(unsigned char active)
{
    HRESULT rval;

    if (WINDOWED || lpDD == NULL)
    {
        return;
    }
    if (active)
    {
        if (!bActive)
        {
            for (;;)
            {
                rval = lpDD->SetDisplayMode(SCRWIDTH, SCRHEIGHT, 16);
                if (rval == DD_OK)
                {
                    break;
                }
                if (rval == DDERR_SURFACELOST)
                {
                    if (!restoreAll())
                    {
                        break;
                    }
                }
            }

            bActive = TRUE;
        }
    }
    else
    {
        if (bActive)
        {
            for (;;)
            {
                rval = lpDD->RestoreDisplayMode();
                if (rval == DD_OK)
                {
                    break;
                }
                if (rval == DDERR_SURFACELOST)
                {
                    if (!restoreAll())
                    {
                        break;
                    }
                }
            }

            bActive = FALSE;
        }
    }
}
开发者ID:Almamu,项目名称:homeworld,代码行数:55,代码来源:draw.cpp

示例2:

	~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

示例3: dd_SetMode

int dd_SetMode(int xres, int yres, int bpp, bool windowflag)
{
	HRESULT hr;

	if (!dd_initd)
		dd_init();

	//do this now for the gamewindow, because this is the first time we know what size to make the gamewindow
	if(!dd_bGameWindowRectInitialized)
	{
		RECT r;
		dd_gameWindow->adjust(xres,yres,&r);

		int base_win_x_res = getInitialWindowXres();
		int base_win_y_res = getInitialWindowYres();

		/// this is for the windowsize verge.cfg vars.
		if( base_win_x_res > 0 && base_win_y_res > 0 ) {
			int win_offset_x = (r.right-r.left) - xres;
			int win_offset_y = (r.bottom-r.top) - yres;

			dd_gameWindow->winw = win_offset_x+base_win_x_res;
			dd_gameWindow->winh = win_offset_y+base_win_y_res;
		
		} else {
			dd_gameWindow->winw = r.right-r.left;
			dd_gameWindow->winh = r.bottom-r.top;
		}

		WINDOWPLACEMENT wp;
		wp.length = sizeof(WINDOWPLACEMENT);
		GetWindowPlacement(dd_gameWindow->hwnd,&wp);
		wp.rcNormalPosition.left = GetSystemMetrics(SM_CXSCREEN)/2-xres/2;
		wp.rcNormalPosition.top = GetSystemMetrics(SM_CYSCREEN)/2-yres/2;
		wp.rcNormalPosition.right = wp.rcNormalPosition.left + dd_gameWindow->winw;
		wp.rcNormalPosition.bottom = wp.rcNormalPosition.top + dd_gameWindow->winh;
		SetWindowPlacement(dd_gameWindow->hwnd,&wp);

		dd_bGameWindowRectInitialized = true;
	}

	//must deactivate all auxwindows
	if(vid_window && !windowflag)
		for(std::vector<dd_Window*>::iterator it = dd_windows.begin(); it != dd_windows.end(); it++)
		{
			if(!(*it)->bGameWindow)
				(*it)->deactivate();
		}

	if (!windowflag)
	{
		//if we are switching into fullscreen, we are going to lose these sizes and positions
		//save them now so we can restore them when we flip back to windowmode
		if(vid_window)
		{
			WINDOWPLACEMENT wp;
			wp.length = sizeof(WINDOWPLACEMENT);
			GetWindowPlacement(dd_gameWindow->hwnd,&wp);
			dd_gameWindow->winx = wp.rcNormalPosition.left;
			dd_gameWindow->winy = wp.rcNormalPosition.top;
			dd_gameWindow->winw = wp.rcNormalPosition.right - wp.rcNormalPosition.left;
			dd_gameWindow->winh = wp.rcNormalPosition.bottom - wp.rcNormalPosition.top;
			dd_bWasMaximized = (wp.showCmd == SW_SHOWMAXIMIZED);
		}

		//ShowWindow(dd_gameWindow->hwnd,SW_SHOWMAXIMIZED);
		ShowWindow(dd_gameWindow->hwnd,SW_HIDE);

		int ret = dd_gameWindow->set_fullscreen(xres,yres,bpp);
		if(!ret)
			return 0;

		ShowWindow(dd_gameWindow->hwnd,SW_SHOW);

		dd_gameWindow->xres = xres;
		dd_gameWindow->yres = yres;

		vid_xres = xres;
		vid_yres = yres;
		vid_window = false;
		dd_bHasBeenFullscreen = true;

		dd_RegisterBlitters();
		return ret;
	}
	else
	{
		DX_RELEASE(dx_ps);
		DX_RELEASE(dx_win_ps);

		if (bpp != DesktopBPP) return 0;
		if (!vid_window)
			dx_dd->RestoreDisplayMode();
		dx_dd->SetCooperativeLevel(dd_gameWindow->hwnd, DDSCL_NORMAL);

		hr = dx_dd->CreateSurface(&dx_win_psd, &dx_win_ps, NULL);
		if (hr != DD_OK)
		{
			return 0;
		}
//.........这里部分代码省略.........
开发者ID:Bananattack,项目名称:verge3,代码行数:101,代码来源:vid_ddbase.cpp


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