Beispiel #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, 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");
            }

            this.options = options;
            this.device  = device;

            this.thread_id = System.Threading.Thread.CurrentThread.ManagedThreadId;

            IPlatformFactory2 factory = (IPlatformFactory2)Factory.Default;

            implementation = (INativeWindow)factory.CreateNativeWindow(x, y, width, height, title, mode, options, this.device);
            factory.RegisterResource(this);

            if ((options & GameWindowFlags.Fullscreen) != 0)
            {
                if (this.device != null)
                {
                    this.device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0);
                }
                WindowState = WindowState.Fullscreen;
            }

            if ((options & GameWindowFlags.FixedWindow) != 0)
            {
                WindowBorder = WindowBorder.Fixed;
            }
        }
Beispiel #2
0
 public EglAnglePlatformFactory(IPlatformFactory2 platform_factory)
 {
     _platform_factory = platform_factory;
 }