• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ChangeDisplaySettings函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GLimp_SetFSMode

static qboolean GLimp_SetFSMode( int *width, int *height )
{
    DEVMODE		dm;
    HRESULT		hr;

    EnumDisplaySettings (NULL, ENUM_CURRENT_SETTINGS, &originalDesktopMode);

    memset( &dm, 0, sizeof( dm ) );
    dm.dmSize		= sizeof( dm );
    dm.dmPelsWidth  = *width;
    dm.dmPelsHeight = *height;
    dm.dmFields     = DM_PELSWIDTH | DM_PELSHEIGHT;

    if (vid_displayfrequency->integer > 30)
    {
        dm.dmFields |= DM_DISPLAYFREQUENCY;
        dm.dmDisplayFrequency = vid_displayfrequency->integer;
        Com_Printf("...using display frequency %i\n", dm.dmDisplayFrequency);
    }
    if ( gl_bitdepth->integer > 0 )
    {
        if(glw_state.allowdisplaydepthchange)
        {
            dm.dmFields |= DM_BITSPERPEL;
            dm.dmBitsPerPel = gl_bitdepth->integer;
            Com_Printf("...using gl_bitdepth of %d\n", gl_bitdepth->integer);
        }
        else
        {
            Com_Printf("WARNING:...changing depth not supported on Win95 < pre-OSR 2.x\n");
        }
    }
    else
    {
        Com_Printf("...using desktop display depth of %d\n", originalDesktopMode.dmBitsPerPel);
    }

    Com_Printf ( "...calling CDS: " );
    hr = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
    if (hr != DISP_CHANGE_SUCCESSFUL)
    {
        DEVMODE		devmode;
        int			modeNum;

        Com_Printf ( "failed\n" );

        switch ((int)hr) {
        case DISP_CHANGE_BADFLAGS: //Shouldnt hapent
            Com_Printf("An invalid set of flags was passed in.\n");
            return false;
        case DISP_CHANGE_BADPARAM: //Shouldnt hapent
            Com_Printf("An invalid parameter was passed in.\n");
            return false;
        case DISP_CHANGE_RESTART:
            Com_Printf("Windows need to restart for that mode.\n");
            return false;
        case DISP_CHANGE_FAILED:
        case DISP_CHANGE_BADMODE:
            if(hr == DISP_CHANGE_FAILED)
                Com_Printf("The display driver failed the specified graphics mode.\n");
            else
                Com_Printf("The graphics mode is not supported.\n");

            if(dm.dmFields & (DM_DISPLAYFREQUENCY|DM_BITSPERPEL)) {
                DWORD fields = dm.dmFields;

                dm.dmFields &= ~(DM_DISPLAYFREQUENCY|DM_BITSPERPEL);

                //Lets try without users params
                if(ChangeDisplaySettings(&dm, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL)
                {
                    if((fields & DM_DISPLAYFREQUENCY) && (fields & DM_BITSPERPEL))
                        Com_Printf("WARNING: vid_displayfrequency & gl_bitdepth is bad value(s), ignored\n");
                    else
                        Com_Printf("WARNING: %s is bad value, ignored\n", (fields & DM_DISPLAYFREQUENCY) ? "vid_displayfrequency" : "gl_bitdepth");

                    return true;
                }
                dm.dmFields = fields; //it wasnt because of that
            }
            break;
        default:
            break;
        }

        // the exact mode failed, so scan EnumDisplaySettings for the next largest mode
        Com_Printf("...trying next higher resolution: " );

        // we could do a better matching job here...
        for ( modeNum = 0 ; ; modeNum++ ) {
            if ( !EnumDisplaySettings( NULL, modeNum, &devmode ) ) {
                modeNum = -1;
                break;
            }
            if ( devmode.dmPelsWidth >= *width
                    && devmode.dmPelsHeight >= *height
                    && devmode.dmBitsPerPel >= 15 ) {
                break;
            }
        }
//.........这里部分代码省略.........
开发者ID:q3aql,项目名称:quake2,代码行数:101,代码来源:glw_imp.c


示例2: GLW_SetMode


//.........这里部分代码省略.........
			dm.dmDisplayFrequency = r_displayRefresh->integer;
			dm.dmFields |= DM_DISPLAYFREQUENCY;
		}

		// try to change color depth if possible
		if ( colorbits != 0 )
		{
			if ( glw_state.allowdisplaydepthchange )
			{
				dm.dmBitsPerPel = colorbits;
				dm.dmFields |= DM_BITSPERPEL;
				ri.Printf( PRINT_ALL, "...using colorsbits of %d\n", colorbits );
			}
			else
			{
				ri.Printf( PRINT_ALL, "WARNING:...changing depth not supported on Win95 < pre-OSR 2.x\n" );
			}
		}
		else
		{
			ri.Printf( PRINT_ALL, "...using desktop display depth of %d\n", glw_state.desktopBitsPixel );
		}

		//
		// if we're already in fullscreen then just create the window
		//
		if ( glw_state.cdsFullscreen )
		{
			ri.Printf( PRINT_ALL, "...already fullscreen, avoiding redundant CDS\n" );

			if ( !GLW_CreateWindow ( drivername, glConfig.vidWidth, glConfig.vidHeight, colorbits, qtrue ) )
			{
				ri.Printf( PRINT_ALL, "...restoring display settings\n" );
				ChangeDisplaySettings( 0, 0 );
				return RSERR_INVALID_MODE;
			}
		}
		//
		// need to call CDS
		//
		else
		{
			ri.Printf( PRINT_ALL, "...calling CDS: " );

			// try setting the exact mode requested, because some drivers don't report
			// the low res modes in EnumDisplaySettings, but still work
			if ( ( cdsRet = ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) ) == DISP_CHANGE_SUCCESSFUL )
			{
				ri.Printf( PRINT_ALL, "ok\n" );

				if ( !GLW_CreateWindow ( drivername, glConfig.vidWidth, glConfig.vidHeight, colorbits, qtrue) )
				{
					ri.Printf( PRINT_ALL, "...restoring display settings\n" );
					ChangeDisplaySettings( 0, 0 );
					return RSERR_INVALID_MODE;
				}

				glw_state.cdsFullscreen = qtrue;
			}
			else
			{
				//
				// the exact mode failed, so scan EnumDisplaySettings for the next largest mode
				//
				DEVMODE		devmode;
				int			modeNum;
开发者ID:anthonynguyen,项目名称:ioq3-for-UrbanTerror-4,代码行数:67,代码来源:win_glimp.c


示例3: create

  void create(HINSTANCE hInstance, int buffer, bool fullscreen, bool border, std::string title, int &x, int &y, unsigned int &w, unsigned int &h) {
    DWORD dwExStyle;
    DWORD style;

    if (fullscreen){
        DEVMODE dmScreenSettings;								// Device Mode

        if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dmScreenSettings)){
            ::error("GEM: couldn't get screen capabilities!");
        } else {
        w = dmScreenSettings.dmPelsWidth;
        h = dmScreenSettings.dmPelsHeight;
        }

        x=y=0;

        memset(&dmScreenSettings,0,sizeof(dmScreenSettings));	// Makes Sure Memory's Cleared
        dmScreenSettings.dmSize=sizeof(dmScreenSettings);		// Size Of The Devmode Structure
        dmScreenSettings.dmPelsWidth	= w;			// Selected Screen Width
        dmScreenSettings.dmPelsHeight	= h;			// Selected Screen Height
        dmScreenSettings.dmBitsPerPel	= 32;					// Selected Bits Per Pixel
        dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
        // Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
        if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) {
          dmScreenSettings.dmPelsWidth	= w;
          dmScreenSettings.dmPelsHeight	= h;
          if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) {
              ::error("couldn't switch to fullscreen");
            fullscreen=false;
          }
        }
      }

      // Since Windows uses some of the window for the border, etc,
      //		we have to ask how big the window should really be
      RECT newSize = getRealRect(x, y, w, h,
                          border, fullscreen,
                          style, dwExStyle);
      // Create the window
      win = CreateWindowEx (
                            dwExStyle,
                            "GEM",
                            title.c_str(),
                            style,
                            newSize.left,
                            newSize.top,
                            newSize.right - newSize.left,
                            newSize.bottom - newSize.top,
                            NULL,
                            NULL,
                            hInstance,
                            NULL);
      if (!win)  {
        throw(GemException("Unable to create window"));
      }
      // create the device context
      dc = GetDC(win);
      if (!dc)  {
        throw(GemException("GEM: Unable to create device context"));
      }

      // set the pixel format for the window
      if (!bSetupPixelFormat(dc, buffer))  {
        throw(GemException("Unable to set window pixel format"));
      }

      // create the OpenGL context
      context = wglCreateContext(dc);
      if (!context)  {
        throw(GemException("Unable to create OpenGL context"));
      }

      // do we share display lists?
      if (sharedContext) wglShareLists(sharedContext, context);

      // make the context the current rendering context
      if (!wglMakeCurrent(dc, context))   {
        throw(GemException("Unable to make OpenGL context current"));
      }
    }
开发者ID:ch-nry,项目名称:Gem,代码行数:80,代码来源:gemw32window.cpp


示例4: WIN_GL_ShutDown


//.........这里部分代码省略.........
	video->flags = 0;	/* Clear flags */
	video->w = width;
	video->h = height;
	video->pitch = SDL_CalculatePitch(video);

#ifdef WIN32_PLATFORM_PSPC
	 /* Stuff to hide that $#!^%#$ WinCE taskbar in fullscreen... */
	if ( flags & SDL_FULLSCREEN ) {
		if ( !(prev_flags & SDL_FULLSCREEN) ) {
			SHFullScreen(SDL_Window, SHFS_HIDETASKBAR);
			SHFullScreen(SDL_Window, SHFS_HIDESIPBUTTON);
			ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_HIDE);
		}
		video->flags |= SDL_FULLSCREEN;
	} else {
		if ( prev_flags & SDL_FULLSCREEN ) {
			SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR);
			SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON);
			ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL);
		}
	}
#endif
#ifndef NO_CHANGEDISPLAYSETTINGS
	/* Set fullscreen mode if appropriate */
	if ( (flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
		DEVMODE settings;

		memset(&settings, 0, sizeof(DEVMODE));
		settings.dmSize = sizeof(DEVMODE);
		settings.dmBitsPerPel = video->format->BitsPerPixel;
		settings.dmPelsWidth = width;
		settings.dmPelsHeight = height;
		settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
		if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) {
			video->flags |= SDL_FULLSCREEN;
			SDL_fullscreen_mode = settings;
		}
	}
#endif /* !NO_CHANGEDISPLAYSETTINGS */

	/* Reset the palette and create a new one if necessary */
	if ( screen_pal != NULL ) {
	/*	RJR: March 28, 2000
		delete identity palette if switching from a palettized mode */
		DeleteObject(screen_pal);
		screen_pal = NULL;
	}
	if ( bpp <= 8 )
	{
	/*	RJR: March 28, 2000
		create identity palette switching to a palettized mode */
		screen_pal = DIB_CreatePalette(bpp);
	}

	style = GetWindowLong(SDL_Window, GWL_STYLE);
	style &= ~(resizestyle|WS_MAXIMIZE);
	if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
		style &= ~windowstyle;
		style |= directstyle;
	} else {
#ifndef NO_CHANGEDISPLAYSETTINGS
		if ( (prev_flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
			ChangeDisplaySettings(NULL, 0);
		}
#endif
		if ( flags & SDL_NOFRAME ) {
开发者ID:Goettsch,项目名称:game-editor,代码行数:67,代码来源:SDL_dibvideo.c


示例5: GLW_ResetDesktopMode

qboolean GLW_ResetDesktopMode( void )
{
	WG_RestoreGamma();
	ChangeDisplaySettings( 0, 0 );
	return qtrue;
}
开发者ID:anthonynguyen,项目名称:ioq3-for-UrbanTerror-4,代码行数:6,代码来源:win_glimp.c


示例6: GetModuleHandle

//初始化窗口类,创建应用程序窗口 
void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight)
{
	WNDCLASSEX wc;
	DEVMODE dmScreenSettings;
	int posX, posY;

	//获取System class对象
	ApplicationHandle = this;
	// 得到应用程序实例句柄 
	m_hinstance = GetModuleHandle(nullptr);
	// 应用程序名字 
	m_applicationName = TEXT("Engine");

	// 设置窗口类参数.
	wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = m_hinstance;
	wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
	wc.hIconSm = wc.hIcon;
	wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wc.lpszMenuName = nullptr;
	wc.lpszClassName = m_applicationName;
	wc.cbSize = sizeof(WNDCLASSEX);

	// 注册窗口类 
	RegisterClassEx(&wc);

	// 得到windows桌面分辨率 
	screenWidth = GetSystemMetrics(SM_CXSCREEN);
	screenHeight = GetSystemMetrics(SM_CYSCREEN);

	// 根据是否全屏设置不同的分辨率
	if(FULL_SCREEN)
	{
		//全屏模式下,设置窗口大小为windows桌面分辨率
		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
		dmScreenSettings.dmSize = sizeof(dmScreenSettings);
		dmScreenSettings.dmPelsWidth = (DWORD)screenWidth;
		dmScreenSettings.dmPelsHeight = (DWORD)screenHeight;
		dmScreenSettings.dmBitsPerPel = 32;
		dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

		// 临时设置显示设备为全屏模式,注意:应用程序退出时候,将恢复系统默认设置
		ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);

		// 设置窗口的左上角坐标位置为(0,0)
		posX = posY = 0;
	}
	else
	{
		// 窗口模式:800*600
		screenWidth = 800;
		screenHeight = 600;

		// 窗口左上角坐标位置,posX, posY
		posX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth) / 2;
		posY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2;
	}

	// 全屏和窗口使用不同的参数. 
	if(FULL_SCREEN)
	{
		m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName, 
			WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP, posX, posY, 
			screenWidth, screenHeight, nullptr, nullptr, m_hinstance, nullptr);
	}
	else
	{
		m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName, 
			WS_OVERLAPPEDWINDOW, posX, posY, screenWidth, screenHeight, 
			nullptr, nullptr, m_hinstance, nullptr);
	}

	// 显示窗口并设置其为焦点. 
	ShowWindow(m_hwnd, SW_SHOW);
	SetForegroundWindow(m_hwnd);
	SetFocus(m_hwnd);

	//隐藏鼠标
	ShowCursor(FALSE);
}
开发者ID:Jesna,项目名称:DirectX,代码行数:85,代码来源:SystemClass.cpp


示例7: WinMain

int WINAPI WinMain(
		HINSTANCE hInstance,
		HINSTANCE hPrevInstance, 
		LPSTR lpCmdLine,
		int nCmdShow)
{
	MSG		msg;	// Структура сообщения Windows
	WNDCLASS	wc; // Структура класса Windows для установки типа окна
	HWND		hWnd;// Сохранение дискриптора окна

	wc.style			= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wc.lpfnWndProc		= (WNDPROC) WndProc;
	wc.cbClsExtra		= 0;
	wc.cbWndExtra		= 0;
	wc.hInstance		= hInstance;
	wc.hIcon			= NULL;
	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground	= NULL;
	wc.lpszMenuName		= NULL;
	wc.lpszClassName	= "OpenGL WinClass";

	if(!RegisterClass(&wc))
	{
	MessageBox(0,"Failed To Register The Window Class.","Error",MB_OK|MB_ICONERROR);
	return FALSE;
	}

	hWnd = CreateWindow(
	"OpenGL WinClass",
	"Jeff Molofee's GL Code Tutorial ... NeHe '99",	// Заголовок вверху окна

	WS_POPUP |
	WS_CLIPCHILDREN |
	WS_CLIPSIBLINGS,

	0, 0,			// Позиция окна на экране
	//640, 480,		// Ширина и высота окна
	1024, 600,		// Ширина и высота окна

	NULL,
	NULL,
	hInstance,
	NULL);

	if(!hWnd)
	{
	MessageBox(0,"Window Creation Error.","Error",MB_OK|MB_ICONERROR); 
		return FALSE;
	}

	DEVMODE dmScreenSettings;			// Режим работы

	memset(&dmScreenSettings, 0, sizeof(DEVMODE));	// Очистка для хранения установок
	dmScreenSettings.dmSize	= sizeof(DEVMODE);		// Размер структуры Devmode
	dmScreenSettings.dmPelsWidth	= 1024;//640;			// Ширина экрана
	dmScreenSettings.dmPelsHeight	= 600;//480;			// Высота экрана
	dmScreenSettings.dmFields	= DM_PELSWIDTH | DM_PELSHEIGHT;	// Режим Пиксела
	ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
	// Переключение в полный экран

	ShowWindow(hWnd, SW_SHOW);
	UpdateWindow(hWnd);
	SetFocus(hWnd);

	POINT  pt;
	POINT  lastPt;
    GetCursorPos(&lastPt);
	//загрузка модели
	Model *pModel = NULL;

	pModel = new MilkshapeModel();
	if ( pModel->loadModelData( "guardianModel/model.ms3d" ) == false )
	{
		MessageBox( NULL, "Couldn't load the model data/model.ms3d", "Error", MB_OK | MB_ICONERROR );
		return 0;  // Если модель не загружена, выходим
	}

	//pModel->reloadTextures();
	//загрузка модели
	gameMap = new CGameMap("Maps\\map1.txt", texture);
	guardian = new CGuardian(1.5f, 1.5f, pModel);
	spawn = new CSpawn(4.0f, 1.5f);

	ShowCursor(FALSE);

	__int64 g_freq = Init();
	__int64 lastTime = GetMicroTickCount();

	//mciSendString("play Fone.mp3 wait", NULL, NULL, NULL);//Проба с музыкой

	while (1)
	{
		// Обработка всех сообщений
		while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
		{
			if (GetMessage(&msg, NULL, 0, 0))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
//.........这里部分代码省略.........
开发者ID:AZAZARKA,项目名称:KGProje-t,代码行数:101,代码来源:lab1.cpp


示例8: GetModuleHandle

bool
System::InitialiseWindows(OpenGL* openGL, int& screenWidth, int& screenHeight)
{
	WNDCLASSEX wc;
	DEVMODE dmScreenSettings;
	int posX, posY;
	bool result;

	//Get and external pointer to this object
	ApplicationHandle = this;

	//Get the instance of this application
	m_hInstance = GetModuleHandle(NULL);

	//Give the application a name
	m_applicationName = "E03";

	//Setup the windows class with default setting
	wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = m_hInstance;
	wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
	wc.hIconSm = wc.hIcon;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wc.lpszMenuName = NULL;
	wc.lpszClassName = m_applicationName;
	wc.cbSize = sizeof(WNDCLASSEX);

	//Register the window class
	RegisterClassEx(&wc);

	//Create a temporary windows to initialise OpenGL extentions
	m_hWnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName, WS_POPUP, 0, 0, 640, 480, NULL, NULL, m_hInstance, NULL);
	if (m_hWnd == NULL)
	{
		return false;
	}

	//Don't show the window
	ShowWindow(m_hWnd, SW_HIDE);

	//Initialise a temporary OpenGL window and load the extentions
	result = m_openGL->InitialiseExtentions(m_hWnd);
	if (!result)
	{
		MessageBox(m_hWnd, "Could not initialize the OpenGL extensions.", "Error", MB_OK);
		return false;
	}

	//Release the temporary window now that the extensions have been initialised
	DestroyWindow(m_hWnd);
	m_hWnd = NULL;

	//Determine the resolution of the clients desktop screen
	screenWidth = GetSystemMetrics(SM_CXSCREEN);
	screenHeight = GetSystemMetrics(SM_CYSCREEN);

	//Setup the screen settings depending on whether or not it is in full screen or windowed mode
	if (FULL_SCREEN)
	{
		//If fullscreen set the screen to maximum size of the users desktop and 32bit
		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
		dmScreenSettings.dmSize = sizeof(dmScreenSettings);
		dmScreenSettings.dmPelsWidth = (unsigned long)screenWidth;
		dmScreenSettings.dmPelsHeight = (unsigned long)screenHeight;
		dmScreenSettings.dmBitsPerPel = 32;
		dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

		//Change the display settings to full screen
		ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);

		//Set the position of the window to the top left corner
		posX = posY = 0;
	}
	else
	{
		//if windowed set the resolution to 800 x 600
		screenWidth = 800;
		screenHeight = 600;

		//Place the window in the middle of the screen
		posX = 0;//(GetSystemMetrics(SM_CXSCREEN)-screenWidth/2);
		posY = 0;//(GetSystemMetrics(SM_CYSCREEN) - screenHeight / 2);
	}

	//Create the window with the screen settings and get the handle to it.
	m_hWnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName, WS_POPUP, posX, posY, screenWidth, screenHeight, NULL, NULL, m_hInstance, NULL);
	if (m_hWnd == NULL)
	{
		return false;
	}

	//Initialise OpenGL now that the window has been created
	result = m_openGL->InitialiseOpenGL(m_hWnd, screenWidth, screenHeight, SCREEN_DEPTH, SCREEN_NEAR, VSYNC_ENABLED);
	if (!result)
	{
		MessageBox(m_hWnd, "Could not initialize OpenGL, check if video card supports OpenGL 4.0.", "Error", MB_OK);
//.........这里部分代码省略.........
开发者ID:moldfire,项目名称:Game-Engine,代码行数:101,代码来源:System.cpp


示例9: GetModuleHandle

/* ================================================================================== */
bool AtlasEngine::initializeWindows(OpenGLClass* ogl, int& width, int& height) {

	WNDCLASSEX wc;
	DEVMODE dmscreensettings;
	int posX, posY;
	bool result;

	// get external pointer to this object
	ApplicationHandle = this;

	// get instance of the current application
	hinstance = GetModuleHandle(NULL);

	// give the application name
	appName = L"Atlas Engine";

	// setup the windows class
	wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wc.lpfnWndProc = WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = hinstance;
	wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
	wc.hIconSm = wc.hIcon;
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wc.lpszMenuName = NULL;
	wc.lpszClassName = appName;
	wc.cbSize = sizeof(WNDCLASSEX);

	// register the window class
	RegisterClassEx(&wc);

	// create temporary window for OPENGL
	hwnd = CreateWindowEx(WS_EX_APPWINDOW, appName, appName, WS_POPUP,
		0, 0, 800, 600, NULL, NULL, hinstance, NULL);
	if(hwnd == NULL)
		return false;

	// dont show the window
	ShowWindow(hwnd, SW_HIDE);

	// initialize temporary opengl window to load extensions
	result = opengl->initializeExtensions(hwnd);
	if(!result)
	{
		MessageBox(hwnd, L"Failed to initialize the OpenGL extensions", L"Error", MB_OK);
		return false;
	}

	// release the temporary window
	DestroyWindow(hwnd);
	hwnd = NULL;

	// determine resolution of the client's desktop screen
	width = GetSystemMetrics(SM_CXSCREEN);
	height = GetSystemMetrics(SM_CYSCREEN);

	// setup the screen settings depending if it is on Fullscreen/Windowed mode
	if(FULL_SCREEN)
	{
		// if fulscreen, set the screen to maximum size
		memset(&dmscreensettings, 0, sizeof(dmscreensettings));
		dmscreensettings.dmSize = sizeof(dmscreensettings);
		dmscreensettings.dmPelsWidth = (unsigned long)width;
		dmscreensettings.dmPelsHeight = (unsigned long)height;
		dmscreensettings.dmBitsPerPel = 32;
		dmscreensettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

		// change display settings to full screen
		ChangeDisplaySettings(&dmscreensettings, CDS_FULLSCREEN);
		// set position of window
		posX = posY = 0;
	}
	else
	{
		// windowed dimensions
		width = 800;
		height = 600;

		// place window in the middle of screen
		posX = (GetSystemMetrics(SM_CXSCREEN) - width)/2;
		posY = (GetSystemMetrics(SM_CYSCREEN) - height)/2;
	}

	// create window
	// OVERLAPPED - for a window with border & controls
	// POPUP - for a window without border
	hwnd = CreateWindowEx(WS_EX_APPWINDOW, appName, appName, WS_OVERLAPPEDWINDOW,
		posX, posY, width, height, NULL, NULL, hinstance, NULL);

	if(hwnd == NULL)
		return false;

	// initialize opengl now
	result = opengl->initializeOpenGL(hwnd, width, height, SCREEN_DEPTH, SCREEN_NEAR, VSYNC_ENABLED);
	if(!result)
	{
		MessageBox(hwnd, L"Failed to initialize OpenGL, make sure your video card supports OpenGL4.0", L"Error", MB_OK);
//.........这里部分代码省略.........
开发者ID:radneyalquiza,项目名称:AtlasEngine-PC,代码行数:101,代码来源:AtlasEngine.cpp


示例10: GetModuleHandle

BOOL OpenGLInterface::CreateGLWindow( LPCWSTR title, int width, int height, int bits, bool fullscreenflag ) {
	GLuint    PixelFormat;
	WNDCLASS  wc;
	DWORD    dwExStyle;
	DWORD    dwStyle;
	
	RECT WindowRect;                // Grabs Rectangle Upper Left / Lower Right Values
	WindowRect.left=(long)0;              // Óñòàíîâèòü ëåâóþ ñîñòàâëÿþùóþ â 0
	WindowRect.right=(long)width;              // Óñòàíîâèòü ïðàâóþ ñîñòàâëÿþùóþ â Width
	WindowRect.top=(long)0;                // Óñòàíîâèòü âåðõíþþ ñîñòàâëÿþùóþ â 0
	WindowRect.bottom=(long)height;              // Óñòàíîâèòü íèæíþþ ñîñòàâëÿþùóþ â Height

	fullscreen = fullscreenflag;              // Óñòàíàâëèâàåì çíà÷åíèå ãëîáàëüíîé ïåðåìåííîé fullscreen
	hInstance    = GetModuleHandle(NULL);        // Ñ÷èòàåì äåñêðèïòîð íàøåãî ïðèëîæåíèÿ
	wc.style    = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;      // Ïåðåðèñóåì ïðè ïåðåìåùåíèè è ñîçäà¸ì ñêðûòûé DC
	wc.lpfnWndProc    = &OpenGLInterface::InitialWndProc;          // Ïðîöåäóðà îáðàáîòêè ñîîáùåíèé
	wc.cbClsExtra    = 0;              // Íåò äîïîëíèòåëüíîé èíôîðìàöèè äëÿ îêíà
	wc.cbWndExtra    = 0;              // Íåò äîïîëíèòåëüíîé èíôîðìàöèè äëÿ îêíà
	wc.hInstance    = hInstance;            // Óñòàíàâëèâàåì äåñêðèïòîð
	wc.hIcon    = LoadIcon(NULL, IDI_WINLOGO);        // Çàãðóæàåì èêîíêó ïî óìîë÷àíèþ
	wc.hCursor    = LoadCursor(NULL, IDC_ARROW);        // Çàãðóæàåì óêàçàòåëü ìûøêè
	wc.hbrBackground  = NULL;              // Ôîí íå òðåáóåòñÿ äëÿ GL
	wc.lpszMenuName    = NULL;              // Ìåíþ â îêíå íå áóäåò
	wc.lpszClassName  = L"OpenGL";            // Óñòàíàâëèâàåì èìÿ êëàññó

	if( !RegisterClass( &wc ) ) {
    MessageBox( NULL, L"Failed To Register The Window Class.", L"ERROR", MB_OK | MB_ICONEXCLAMATION );
    return false;                // Âûõîä è âîçâðàùåíèå ôóíêöèåé çíà÷åíèÿ false
	}

	if( fullscreen ) {
		DEVMODE dmScreenSettings;            // Ðåæèì óñòðîéñòâà
		memset( &dmScreenSettings, 0, sizeof( dmScreenSettings ) );    // Î÷èñòêà äëÿ õðàíåíèÿ óñòàíîâîê
		dmScreenSettings.dmSize=sizeof( dmScreenSettings );      // Ðàçìåð ñòðóêòóðû Devmode
		dmScreenSettings.dmPelsWidth  =   width;        // Øèðèíà ýêðàíà
		dmScreenSettings.dmPelsHeight  =   height;        // Âûñîòà ýêðàíà
		dmScreenSettings.dmBitsPerPel  =   bits;        // Ãëóáèíà öâåòà
		dmScreenSettings.dmFields= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;// Ðåæèì Ïèêñåëÿ
		// Ïûòàåìñÿ óñòàíîâèòü âûáðàííûé ðåæèì è ïîëó÷èòü ðåçóëüòàò.  Ïðèìå÷àíèå: CDS_FULLSCREEN óáèðàåò ïàíåëü óïðàâëåíèÿ.
		if( ChangeDisplaySettings( &dmScreenSettings, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL ) {
			if( MessageBox( NULL, L"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?", L"NeHe GL", MB_YESNO | MB_ICONEXCLAMATION) == IDYES ) {
				fullscreen = false;
			} else {
				MessageBox( NULL, L"Program Will Now Close.", L"ERROR", MB_OK | MB_ICONSTOP );
				return false;
			}
		}
	}

	if(fullscreen) {
		dwExStyle  =   WS_EX_APPWINDOW;          // Ðàñøèðåííûé ñòèëü îêíà
		dwStyle    =   WS_POPUP;            // Îáû÷íûé ñòèëü îêíà
		ShowCursor( true );
	} else {
		dwExStyle  =   WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;      // Ðàñøèðåííûé ñòèëü îêíà
		dwStyle    =   WS_OVERLAPPEDWINDOW;        // Îáû÷íûé ñòèëü îêíà
	}
	AdjustWindowRectEx( &WindowRect, dwStyle, false, dwExStyle );

	if( !( hWnd = CreateWindowEx(  dwExStyle,          // Ðàñøèðåííûé ñòèëü äëÿ îêíà
          _T("OpenGL"),          // Èìÿ êëàññà
          title,            // Çàãîëîâîê îêíà
          WS_CLIPSIBLINGS |        // Òðåáóåìûé ñòèëü äëÿ îêíà
          WS_CLIPCHILDREN |        // Òðåáóåìûé ñòèëü äëÿ îêíà
          dwStyle,          // Âûáèðàåìûå ñòèëè äëÿ îêíà
          0, 0,            // Ïîçèöèÿ îêíà
          WindowRect.right-WindowRect.left,    // Âû÷èñëåíèå ïîäõîäÿùåé øèðèíû
          WindowRect.bottom-WindowRect.top,    // Âû÷èñëåíèå ïîäõîäÿùåé âûñîòû
          NULL,            // Íåò ðîäèòåëüñêîãî
          NULL,            // Íåò ìåíþ
          hInstance,          // Äåñêðèïòîð ïðèëîæåíèÿ
          this ) ) ) {          // Íå ïåðåäà¸ì íè÷åãî äî WM_CREATE (???)
			  KillGLWindow();                // Âîññòàíîâèòü ýêðàí
			  MessageBox( NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION );
			  return false;                // Âåðíóòü false
	}

	static  PIXELFORMATDESCRIPTOR pfd=            // pfd ñîîáùàåò Windows êàêèì áóäåò âûâîä íà ýêðàí êàæäîãî ïèêñåëÿ
  {
    sizeof(PIXELFORMATDESCRIPTOR),            // Ðàçìåð äåñêðèïòîðà äàííîãî ôîðìàòà ïèêñåëåé
    1,                  // Íîìåð âåðñèè
    PFD_DRAW_TO_WINDOW |              // Ôîðìàò äëÿ Îêíà
    PFD_SUPPORT_OPENGL |              // Ôîðìàò äëÿ OpenGL
    PFD_DOUBLEBUFFER,              // Ôîðìàò äëÿ äâîéíîãî áóôåðà
    PFD_TYPE_RGBA,                // Òðåáóåòñÿ RGBA ôîðìàò
    bits,                  // Âûáèðàåòñÿ áèò ãëóáèíû öâåòà
    0, 0, 0, 0, 0, 0,              // Èãíîðèðîâàíèå öâåòîâûõ áèòîâ
    0,                  // Íåò áóôåðà ïðîçðà÷íîñòè
    0,                  // Ñäâèãîâûé áèò èãíîðèðóåòñÿ
    0,                  // Íåò áóôåðà íàêîïëåíèÿ
    0, 0, 0, 0,                // Áèòû íàêîïëåíèÿ èãíîðèðóþòñÿ
    32,                  // 32 áèòíûé Z-áóôåð (áóôåð ãëóáèíû)
    0,                  // Íåò áóôåðà òðàôàðåòà
    0,                  // Íåò âñïîìîãàòåëüíûõ áóôåðîâ
    PFD_MAIN_PLANE,                // Ãëàâíûé ñëîé ðèñîâàíèÿ
    0,                  // Çàðåçåðâèðîâàíî
    0, 0, 0                  // Ìàñêè ñëîÿ èãíîðèðóþòñÿ
  };

	if( !( hDC = GetDC( hWnd ) ) ) {             // Ìîæåì ëè ìû ïîëó÷èòü Êîíòåêñò Óñòðîéñòâà?
//.........这里部分代码省略.........
开发者ID:a-einstein1879,项目名称:MarketProject,代码行数:101,代码来源:outputGraphics.cpp


示例11: PlatformRestoreDesktopDisplayMode

void PlatformRestoreDesktopDisplayMode()
{
	ChangeDisplaySettings(NULL, 0);
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:4,代码来源:OpenGLWindows.cpp


示例12: RestoreQ2Settings

static void RestoreQ2Settings (void)
{
    if (ChangeDisplaySettings( &fullScreenMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL )
        PrintWinError("Couldn't restore Quake 2 display settings - ChangeDisplaySettings", true);
}
开发者ID:q3aql,项目名称:quake2,代码行数:5,代码来源:glw_imp.c


示例13: RestoreDesktopSettings

static void RestoreDesktopSettings (void)
{
    if (ChangeDisplaySettings( &originalDesktopMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL )
        PrintWinError("Couldn't restore desktop display settings - ChangeDisplaySettings", true);
}
开发者ID:q3aql,项目名称:quake2,代码行数:5,代码来源:glw_imp.c


示例14: GetModuleHandle

bool GameSystem::InitializeWindows(int& screenWidth, int& screenHeight)
{
	WNDCLASSEX wndClass = { 0 };
	DEVMODE dmScreenSettings;
	int posX, posY;

	ApplicationHandle = this;
	m_hInstance = GetModuleHandle(NULL);
	m_applicationName = L"Cavalcade";

	wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	wndClass.lpfnWndProc = WndProc;
	wndClass.cbClsExtra = 0;
	wndClass.cbWndExtra = 0;
	wndClass.hInstance = m_hInstance;
	wndClass.hIcon = LoadIcon(NULL, IDI_WINLOGO);
	wndClass.hIconSm = wndClass.hIcon;
	wndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
	wndClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	wndClass.lpszMenuName = 0;
	wndClass.lpszClassName = m_applicationName;
	wndClass.cbSize = sizeof(WNDCLASSEX);

	RegisterClassEx(&wndClass);

	screenWidth = GetSystemMetrics(SM_CXSCREEN);
	screenHeight = GetSystemMetrics(SM_CYSCREEN);
	
	//RECT rc;
	if (FULLSCREEN_ENABLED)
	{
		/*
		rc.top = 0;
		rc.left = 0;
		rc.right = screenWidth;
		rc.bottom = screenHeight;

		AdjustWindowRect(&rc, WS_EX_APPWINDOW, FALSE);

		m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName,
								WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP,
								CW_USEDEFAULT, CW_USEDEFAULT, screenWidth, screenHeight,
								NULL, NULL, m_hInstance, NULL);
		*/

		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
		//ZeroMemory(&dmScreenSettings, sizeof(dmScreenSettings));
		dmScreenSettings.dmSize = sizeof(dmScreenSettings);
		//dmScreenSettings.dmPosition = dmPos;		// Use for multi-monitor support
		dmScreenSettings.dmPelsWidth = (unsigned long)screenWidth;
		dmScreenSettings.dmPelsHeight = (unsigned long)screenHeight;
		dmScreenSettings.dmBitsPerPel = 32;
		dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

		ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);

		posX = 0;
		posY = 0;
	}
	else
	{
		/*
		rc.top = 0;
		rc.left = 0;
		rc.right = 800;
		rc.bottom = 600;
		
		AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE);

		m_hwnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, m_applicationName, m_applicationName,
								WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP,
								CW_USEDEFAULT, CW_USEDEFAULT, rc.right, rc.bottom,
								NULL, NULL, m_hInstance, NULL);
		*/

		screenWidth = 800;
		screenHeight = 600;
		posX = (GetSystemMetrics(SM_CXSCREEN) - screenWidth) / 2;
		posY = (GetSystemMetrics(SM_CYSCREEN) - screenHeight) / 2;
	}

	m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName,
								WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP,
								posX, posY, screenWidth, screenHeight,
								NULL, NULL, m_hInstance, NULL);
	if (!m_hwnd)
	{
		MessageBox(m_hwnd, L"Error creating window.\n", L"Error", MB_OK);
		return false;
	}

	// Register raw input devices immediately after creating the window
	RAWINPUTDEVICE rid[2];

	// Keyboard
	rid[0].usUsagePage = 1;
	rid[0].usUsage = 6;
	rid[0].dwFlags = 0;		// Change to RIDEV_NOLEGACY when ESC supported
	rid[0].hwndTarget = NULL;

//.........这里部分代码省略.........
开发者ID:dblalock08,项目名称:cavalcade,代码行数:101,代码来源:GameSystem.cpp


示例15: CreateGLWindow

BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
	GLuint		PixelFormat;						// 保存查找匹配的结果
	WNDCLASS	wc;									// 窗口类结构
	DWORD		dwExStyle;							// 扩展窗口风格
	DWORD		dwStyle;							// 窗口风格

	RECT WindowRect;								// 取得矩形的左上角和右下角的坐标值
	WindowRect.left=(long)0;						// 将Left   设为 0
	WindowRect.right=(long)width;					// 将Right  设为要求的宽度
	WindowRect.top=(long)0;							// 将Top    设为 0
	WindowRect.bottom=(long)height;					// 将Bottom 设为要求的高度

	fullscreen=fullscreenflag;						// 设置全局全屏标志

	hInstance		= GetModuleHandle(NULL);		// 取得我们窗口的实例
	wc.style		= CS_HREDRAW | CS_VREDRAW | CS_OWNDC;// 移动时重画,并为窗口取得DC
	wc.lpfnWndProc		= (WNDPROC) WndProc;			// WndProc处理消息
	wc.cbClsExtra		= 0;						// 无额外窗口数据
	wc.cbWndExtra		= 0;						// 无额外窗口数据
	wc.hInstance		= hInstance;				// 设置实例
	wc.hIcon		= LoadIcon(NULL, IDI_WINLOGO);	// 装入缺省图标
	wc.hCursor		= LoadCursor(NULL, IDC_ARROW);	// 装入鼠标指针
	wc.hbrBackground	= NULL;						// GL不需要背景
	wc.lpszMenuName		= NULL;						// 不需要菜单
	wc.lpszClassName	=  "OpenG";					// 设定类名字

	if (!RegisterClass(&wc))						// 尝试注册窗口类
	{
		MessageBox(NULL, "注册窗口失败", "错误",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;								// 退出并返回FALSE
	}

	if (fullscreen)									// 要尝试全屏模式吗?
	{
		DEVMODE dmScreenSettings;					// 设备模式
		memset(&dmScreenSettings,0,sizeof(dmScreenSettings));// 确保内存清空为零
		dmScreenSettings.dmSize=sizeof(dmScreenSettings);// Devmode 结构的大小
		dmScreenSettings.dmPelsWidth	= width;	// 所选屏幕宽度
		dmScreenSettings.dmPelsHeight	= height;	// 所选屏幕高度
		dmScreenSettings.dmBitsPerPel	= bits;		// 每象素所选的色彩深度
		dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;

		// 尝试设置显示模式并返回结果。注: CDS_FULLSCREEN 移去了状态条。
		if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
		{
			// 若模式失败,提供两个选项:退出或在窗口内运行。
			if (MessageBox(NULL, "全屏模式在当前显卡上设置失败!\n使用窗口模式?", "NeHe G",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
			{
				fullscreen=FALSE;				// 选择窗口模式(Fullscreen=FALSE)
			}
			else
			{
				// 弹出一个对话框,告诉用户程序结束
				MessageBox(NULL, "程序将被关闭", "错误",MB_OK|MB_ICONSTOP);
				return FALSE;					//  退出并返回 FALSE
			}
		}
	}

	if (fullscreen)								// 仍处于全屏模式吗?
	{
		dwExStyle=WS_EX_APPWINDOW;				// 扩展窗体风格
		dwStyle=WS_POPUP;						// 窗体风格
		ShowCursor(FALSE);						// 隐藏鼠标指针
	}
	else
	{
		dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;	// 扩展窗体风格
		dwStyle=WS_OVERLAPPEDWINDOW;					//  窗体风格
	}
	AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle);// 调整窗口达到真正要求的大小

	if (!(hWnd=CreateWindowEx(	dwExStyle,		// 扩展窗体风格
					 "OpenG",					// 类名字
					 title,						// 窗口标题
					WS_CLIPSIBLINGS |			// 必须的窗体风格属性
					WS_CLIPCHILDREN |			// 必须的窗体风格属性
					dwStyle,					// 选择的窗体属性
					0, 0,						// 窗口位置
					WindowRect.right-WindowRect.left,	// 计算调整好的窗口宽度
					WindowRect.bottom-WindowRect.top,	// 计算调整好的窗口高度
					NULL,						// 无父窗口
					NULL,						// 无菜单
					hInstance,					// 实例
					NULL)))						// 不向WM_CREATE传递任何东东
	{
		KillGLWindow();							// 重置显示区
		MessageBox(NULL, "不能创建一个窗口设备描述表", "错误",MB_OK|MB_ICONEXCLAMATION);
		return FALSE;							// 返回 FALSE
	}

	static	PIXELFORMATDESCRIPTOR pfd=			// /pfd 告诉窗口我们所希望的东东,即窗口使用的像素格式
	{
		sizeof(PIXELFORMATDESCRIPTOR),			// 上述格式描述符的大小
		1,										// 版本号
		PFD_DRAW_TO_WINDOW |					// 格式支持窗口
		PFD_SUPPORT_OPENGL |					// 格式必须支持OpenGL
		PFD_DOUBLEBUFFER,						// 必须支持双缓冲
		PFD_TYPE_RGBA,							// 申请 RGBA 格式
//.........这里部分代码省略.........
开发者ID:Japhon,项目名称:hijiangtao.github.io,代码行数:101,代码来源:DataBlog_OpenGLObjectWiggle.cpp


示例16: ChangeDisplaySettings

	// return to desktop at original resolution
	void Window::endFullScreen() { ChangeDisplaySettings(NULL, 0); }
开发者ID:Deronater22,项目名称:Dawn-of-the-living,代码行数:2,代码来源:oglwindow.cpp


示例17: SysRecoverDisplayMode

void SysRecoverDisplayMode()
{
	ChangeDisplaySettings( NULL, 0 );
}
开发者ID:amanjainhiman,项目名称:cylindrix,代码行数:4,代码来源:winmain.cpp


示例18: WndProc

LRESULT CALLBACK WndProc(
				HWND	hWnd,
				UINT	message,
				WPARAM	wParam,
		 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ChangeDisplaySettingsEx函数代码示例发布时间:2022-05-30
下一篇:
C++ Change函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap