예제 #1
0
        /// <summary>
        /// Create a new GlfwWindow.
        /// </summary>
        /// <param name="options">The options to use for this window.</param>
        public unsafe GlfwWindow(WindowOptions options, GlfwWindow parent, GlfwMonitor monitor)
        {
            // Title and Size must be set before the window is created.
            _title = options.Title;
            _size  = options.Size;

            _windowBorder = WindowBorder;

            FramesPerSecond  = options.FramesPerSecond;
            UpdatesPerSecond = options.UpdatesPerSecond;

            RunningSlowTolerance    = options.RunningSlowTolerance;
            UseSingleThreadedWindow = options.UseSingleThreadedWindow;
            ShouldSwapAutomatically = options.ShouldSwapAutomatically;

            _initialOptions = options;
            _initialMonitor = monitor;
            Parent          = (IWindowHost)parent ?? _initialMonitor;

            GlfwProvider.GLFW.Value.GetVersion(out var major, out var minor, out _);
            if (new Version(major, minor) < new Version(3, 3))
            {
                throw new NotSupportedException("GLFW 3.3 or later is required for Silk.NET.Windowing.Desktop.");
            }
        }
예제 #2
0
        /// <summary>
        /// Create a new GlfwWindow.
        /// </summary>
        /// <param name="options">The options to use for this window.</param>
        public GlfwWindow(WindowOptions options, GlfwWindow parent, GlfwMonitor monitor)
        {
            // Title and Size must be set before the window is created.
            _title = options.Title;
            _size  = options.Size;

            _windowBorder = WindowBorder;
            _vSync        = options.VSync;

            FramesPerSecond  = options.FramesPerSecond;
            UpdatesPerSecond = options.UpdatesPerSecond;

            RunningSlowTolerance    = options.RunningSlowTolerance;
            UseSingleThreadedWindow = options.UseSingleThreadedWindow;
            ShouldSwapAutomatically = options.ShouldSwapAutomatically;

            _initialOptions = options;
            _initialMonitor = monitor;
            Parent          = (IWindowHost)parent ?? _initialMonitor;
            IsEventDriven   = options.IsEventDriven;

            GlfwProvider.GLFW.Value.GetVersion(out var major, out var minor, out _);
            if (new Version(major, minor) < new Version(3, 3))
            {
                throw new NotSupportedException("GLFW 3.3 or later is required for Silk.NET.Windowing.Desktop.");
            }

            if (options.API.API == ContextAPI.Vulkan)
            {
                VkSurface = new Surface(this);
            }
            else if (options.API.API == ContextAPI.OpenGL || options.API.API == ContextAPI.OpenGLES)
            {
                GLContext = new Context(this);
            }

            Glfw.ThrowExceptions();
        }