/// <summary> /// Gets the main monitor. /// </summary> /// <returns>The main monitor.</returns> public static IMonitor GetMainMonitor() { if (!SilkManager.IsRegistered <IWindowPlatform>()) { Window.Init(); } return(SilkManager.Get <IWindowPlatform>().GetMainMonitor()); }
/// <summary> /// Gets all monitors present on this window platform. /// </summary> /// <returns>All monitors present on this window platform</returns> public static IEnumerable <IMonitor> GetMonitors() { if (!SilkManager.IsRegistered <IWindowPlatform>()) { Window.Init(); } return(SilkManager.Get <IWindowPlatform>().GetMonitors()); }
/// <summary> /// Clears all current contexts for this backend on the current thread. /// </summary> public static void ClearCurrentContexts() { if (!SilkManager.IsRegistered <IWindowPlatform>()) { Init(); } SilkManager.Get <IWindowPlatform>().ClearContexts(); }
/// <summary> /// Create a window on the current platform. /// </summary> /// <param name="options">The window to use.</param> /// <returns>A Silk.NET window using the current platform.</returns> public static IWindow Create(WindowOptions options) { if (!SilkManager.IsRegistered <IWindowPlatform>()) { Init(); } // We should have a platform now, as Silk.Init would've thrown otherwise. // ReSharper disable once PossibleNullReferenceException return(SilkManager.Get <IWindowPlatform>().GetWindow(options)); }
/// <summary> /// Attempts to resolve an <see cref="IWindowPlatform" />. /// </summary> /// <exception cref="NotSupportedException"> /// Thrown if no applicable <see cref="IWindowPlatform" /> was found. /// </exception> public static void Init() { var glfwPlatform = new GlfwPlatform(); if (glfwPlatform.IsApplicable) { SilkManager.Register <IWindowPlatform>(glfwPlatform); SilkManager.Register <IGLSymbolLoader>(new GlfwLoader()); return; } // TODO: Mobile if (!SilkManager.IsRegistered <IWindowPlatform>()) { throw new NotSupportedException("Couldn't find a suitable windowing platform. Generally, this means that your GLFW library is missing."); } }
/// <summary> /// Create a window on the current platform. /// </summary> /// <param name="options">The window to use.</param> /// <returns>A Silk.NET window using the current platform.</returns> public static IWindow Create(WindowOptions options) { if (!SilkManager.IsRegistered <IWindowPlatform>()) { Init(); } if (IsViewOnly) { throw new NotSupportedException ( "The currently bound window platform only supports views," + "instead of windows. Use the view APIs instead." ); } // We should have a platform now, as Silk.Init would've thrown otherwise. // ReSharper disable once PossibleNullReferenceException return(SilkManager.Get <IWindowPlatform>().CreateWindow(options)); }
/// <summary> /// Attempts to resolve an <see cref="IWindowPlatform" />. /// </summary> /// <exception cref="NotSupportedException"> /// Thrown if no applicable <see cref="IWindowPlatform" /> was found. /// </exception> public static void Init() { var glfwPlatform = new GlfwPlatform(); if (glfwPlatform.IsApplicable) { SilkManager.Register <IWindowPlatform>(glfwPlatform); SilkManager.Register <IGLSymbolLoader>(new GlfwLoader()); return; } // TODO: Mobile if (!SilkManager.IsRegistered <IWindowPlatform>()) { throw new NotSupportedException ( "Couldn't find a suitable windowing platform. You probably forgot to copy a glfw3 library into " + "your bin/Debug or bin/Release folder (this won't be a problem in Preview 4)" ); } }
/// <summary> /// Attempts to resolve an <see cref="IWindowPlatform" />. /// </summary> /// <exception cref="NotSupportedException"> /// Thrown if no applicable <see cref="IWindowPlatform" /> was found. /// </exception> internal static void Init() { var glfwPlatform = GlfwPlatform.Instance; if (glfwPlatform.IsApplicable) { SilkManager.Register <IWindowPlatform>(glfwPlatform); SilkManager.Register <GLSymbolLoader>(new GlfwLoader()); return; } // TODO: Mobile if (!SilkManager.IsRegistered <IWindowPlatform>()) { var entAsm = Assembly.GetEntryAssembly()?.Location; entAsm = entAsm is null ? "the entry assembly" : Path.GetFileName(entAsm); throw new NotSupportedException ( "Couldn't find a suitable windowing platform. \n" + $"GLFW: Copy a GLFW 3.3 binary into the same directory as {entAsm}\n" ); } }