예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="fullScreen"></param>
        /// <param name="miscParams"></param>
        public override void Create(string name, int width, int height, bool fullScreen, Collections.NamedParameterList miscParams)
        {
            string title            = name;
            bool   vsync            = false;
            int    depthBuffer      = GraphicsMode.Default.Depth;
            float  displayFrequency = 60f;
            string border           = "resizable";

            this.Name         = name;
            this.Width        = width;
            this.Height       = height;
            this.ColorDepth   = 32;
            this.IsFullScreen = fullScreen;

            #region Parameter Handling

            if (miscParams != null)
            {
                foreach (var entry in miscParams)
                {
                    switch (entry.Key)
                    {
                    case "title":
                        title = entry.Value.ToString();
                        break;

                    case "left":
                        left = Int32.Parse(entry.Value.ToString());
                        break;

                    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":
                        var iphoneContext = (OpenTK.Graphics.IGraphicsContext)entry.Value;
                        _glContext = new IPhoneContext(iphoneContext, _glSupport);
                        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);
                        }
                        _window = ptr;

                        fullScreen = false;
                        IsActive   = true;
                        break;

                    case "externalWindow":
                        fullScreen = false;
                        IsActive   = true;
                        break;

                    default:
                        break;
                    }
                }
            }

            #endregion Parameter Handling
        }
예제 #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="name"></param>
		/// <param name="width"></param>
		/// <param name="height"></param>
		/// <param name="fullScreen"></param>
		/// <param name="miscParams"></param>
		public override void Create( string name, int width, int height, bool fullScreen, Collections.NamedParameterList miscParams )
		{
			string title = name;
			bool vsync = false;
			int depthBuffer = GraphicsMode.Default.Depth;
			float displayFrequency = 60f;
			string border = "resizable";

			this.Name = name;
			this.Width = width;
			this.Height = height;
			this.ColorDepth = 32;
			this.IsFullScreen = fullScreen;

			#region Parameter Handling

			if ( miscParams != null )
			{
				foreach ( var entry in miscParams )
				{
					switch ( entry.Key )
					{
						case "title":
							title = entry.Value.ToString();
							break;
						case "left":
							left = Int32.Parse( entry.Value.ToString() );
							break;
						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":
						    var iphoneContext = (OpenTK.Graphics.IGraphicsContext)entry.Value;
							_glContext = new IPhoneContext( iphoneContext, _glSupport );
							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 );
							}
							_window = ptr;

							fullScreen = false;
							IsActive = true;
							break;

						case "externalWindow":
							fullScreen = false;
							IsActive = true;
							break;

						default:
							break;
					}
				}
			}

			#endregion Parameter Handling

		}