示例#1
0
 /// <summary>Constructs a new NativeWindow with the specified attributes.</summary>
 /// <param name="x">Horizontal screen space coordinate of the NativeWindow's origin.</param>
 /// <param name="y">Vertical screen space coordinate of the NativeWindow's origin.</param>
 /// <param name="width">The width of the NativeWindow in pixels.</param>
 /// <param name="height">The height of the NativeWindow in pixels.</param>
 /// <param name="title">The title of the NativeWindow.</param>
 /// <param name="options">GameWindow options specifying window appearance and behavior.</param>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the NativeWindow.</param>
 /// <param name="device">The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in.</param>
 /// <exception cref="System.ArgumentOutOfRangeException">If width or height is less than 1.</exception>
 /// <exception cref="System.ArgumentNullException">If mode or device is null.</exception>
 public NativeWindow(int x, int y, int width, int height, string title, GameWindowFlags options, OpenTK.Graphics.GraphicsMode mode, DisplayDevice device)
 {
     // TODO: Should a constraint be added for the position?
     if (width < 1)
     {
         throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
     }
     if (height < 1)
     {
         throw new ArgumentOutOfRangeException("height", "Must be greater than zero.");
     }
     if (mode == null)
     {
         throw new ArgumentNullException("mode");
     }
     if (device == null)
     {
         throw new ArgumentNullException("device");
     }
     this.options   = options;
     this.device    = device;
     implementation = (INativeWindow2)Factory.Default.CreateNativeWindow(x, y, width, height, title, mode, options, this.device);
     if ((options & GameWindowFlags.Fullscreen) != 0)
     {
         this.device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0);
         WindowState = WindowState.Fullscreen;
     }
 }
示例#2
0
 /// <summary>Constructs a new NativeWindow with the specified attributes.</summary>
 /// <param name="x">Horizontal screen space coordinate of the NativeWindow's origin.</param>
 /// <param name="y">Vertical screen space coordinate of the NativeWindow's origin.</param>
 /// <param name="width">The width of the NativeWindow in pixels.</param>
 /// <param name="height">The height of the NativeWindow in pixels.</param>
 /// <param name="title">The title of the NativeWindow.</param>
 /// <param name="options">GameWindow options specifying window appearance and behavior.</param>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the NativeWindow.</param>
 /// <param name="device">The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in.</param>
 /// <exception cref="System.ArgumentOutOfRangeException">If width or height is less than 1.</exception>
 /// <exception cref="System.ArgumentNullException">If mode or device is null.</exception>
 public NativeWindow(int x, int y, int width, int height, string title, GameWindowFlags options, OpenTK.Graphics.GraphicsMode mode, DisplayDevice device)
 {
     // TODO: Should a constraint be added for the position?
     if (width < 1)
         throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
     if (height < 1)
         throw new ArgumentOutOfRangeException("height", "Must be greater than zero.");
     if (mode == null)
         throw new ArgumentNullException("mode");
     if (device == null)
         throw new ArgumentNullException("device");
     this.options = options;
     this.device = device;
     implementation = (INativeWindow2)Factory.Default.CreateNativeWindow(x, y, width, height, title, mode, options, this.device);
     if ((options & GameWindowFlags.Fullscreen) != 0)
     {
         this.device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0);
         WindowState = WindowState.Fullscreen;
     }
 }