您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ChangeDisplaySettings函数代码示例

51自学网 2021-06-01 20:09:54
  C++
这篇教程C++ ChangeDisplaySettings函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例5: GLW_ResetDesktopMode

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


示例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,


示例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,


示例8: GetModuleHandle

boolSystem::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,


示例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,


示例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;              // 
C++ ChangeDisplaySettingsEx函数代码示例
C++ Change函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。