當前位置: 首頁>>代碼示例>>C#>>正文


C# DisplayDevice.ChangeResolution方法代碼示例

本文整理匯總了C#中OpenTK.DisplayDevice.ChangeResolution方法的典型用法代碼示例。如果您正苦於以下問題:C# DisplayDevice.ChangeResolution方法的具體用法?C# DisplayDevice.ChangeResolution怎麽用?C# DisplayDevice.ChangeResolution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenTK.DisplayDevice的用法示例。


在下文中一共展示了DisplayDevice.ChangeResolution方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Create


//.........這裏部分代碼省略.........
						case "top":
							top = Int32.Parse( entry.Value.ToString() );
							break;
						case "fsaa":
							fsaa = Int32.Parse( entry.Value.ToString() );
							break;
						case "colourDepth":
						case "colorDepth":
							colorDepth = Int32.Parse( entry.Value.ToString() );
							break;
						case "vsync":
							vsync = entry.Value.ToString() == "No" ? false : true;
							break;
						case "displayFrequency":
							displayFrequency = Int32.Parse( entry.Value.ToString() );
							break;
						case "depthBuffer":
							depthBuffer = Int32.Parse( entry.Value.ToString() );
							break;
						case "border":
							border = entry.Value.ToString().ToLower();
							break;

						case "externalWindowInfo":
							glContext = new OpenTKGLContext( (OpenTK.Platform.IWindowInfo)entry.Value );
							break;

						case "externalWindowHandle":
							object handle = entry.Value;
							IntPtr ptr = IntPtr.Zero;
							if ( handle.GetType() == typeof( IntPtr ) )
							{
								ptr = (IntPtr)handle;
							}
							else if ( handle.GetType() == typeof( System.Int32 ) )
							{
								ptr = new IntPtr( (int)handle );
							}
							//glContext = new OpenTKGLContext(Control.FromHandle(ptr), Control.FromHandle(ptr).Parent);

							WindowEventMonitor.Instance.RegisterWindow( this );
							fullScreen = false;
							IsActive = true;
							break;

						case "externalWindow":
							//glContext = new OpenTKGLContext((Control)entry.Value, ((Control)entry.Value).Parent);
							WindowEventMonitor.Instance.RegisterWindow( this );
							fullScreen = false;
							IsActive = true;
							break;

						default:
							break;
					}
				}
			}

			#endregion Parameter Handling

			if ( glContext == null )
			{
				// create window
				_window = new NativeWindow( width, height, title, GameWindowFlags.Default, new GraphicsMode( GraphicsMode.Default.ColorFormat, depthBuffer, GraphicsMode.Default.Stencil, FSAA ), displayDevice );
				glContext = new OpenTKGLContext( _window.WindowInfo );

				FileSystem.FileInfoList ico = ResourceGroupManager.Instance.FindResourceFileInfo( ResourceGroupManager.DefaultResourceGroupName, "AxiomIcon.ico" );
				if ( ico.Count != 0 )
				{
					_window.Icon = System.Drawing.Icon.ExtractAssociatedIcon( ico[ 0 ].Filename );
				}

				if ( fullScreen )
				{
					displayDevice.ChangeResolution( width, height, ColorDepth, displayFrequency );
					_window.WindowState = WindowState.Fullscreen;
					IsFullScreen = true;
				}
				else
				{
					_window.WindowState = WindowState.Normal;

					if ( border == "fixed" )
						_window.WindowBorder = WindowBorder.Fixed;
					else if ( border == "resizable" )
						_window.WindowBorder = WindowBorder.Resizable;
					else if ( border == "none" )
						_window.WindowBorder = WindowBorder.Hidden;
				}

				_window.Title = title;

				WindowEventMonitor.Instance.RegisterWindow( this );

				// lets get active!
				IsActive = true;
				glContext.VSync = vsync;
				_window.Visible = true;
			}
		}
開發者ID:WolfgangSt,項目名稱:axiom,代碼行數:101,代碼來源:OpenTKWindow.cs


注:本文中的OpenTK.DisplayDevice.ChangeResolution方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。