From c6e531e32369df8610cace0d53faec6dbfcbf925 Mon Sep 17 00:00:00 2001 From: Dylan Perks <11160611+Perksey@users.noreply.github.com> Date: Wed, 27 Sep 2023 13:44:33 -0500 Subject: [PATCH] Update GlfwWindowing.cs --- .../Silk.NET.Windowing.Glfw/GlfwWindowing.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Windowing/Silk.NET.Windowing.Glfw/GlfwWindowing.cs b/src/Windowing/Silk.NET.Windowing.Glfw/GlfwWindowing.cs index d3132b4838..692372c6c6 100644 --- a/src/Windowing/Silk.NET.Windowing.Glfw/GlfwWindowing.cs +++ b/src/Windowing/Silk.NET.Windowing.Glfw/GlfwWindowing.cs @@ -9,13 +9,20 @@ public static class GlfwWindowing { public static void RegisterPlatform() { - Window.Add(new GlfwPlatform()); + if (Window.GetOrDefault() is null) + { + Window.Add(new GlfwPlatform()); + } } /// /// Prioritizes the GLFW windowing platform over others. /// - public static void Use() => Window.PrioritizeGlfw(); + public static void Use() + { + RegisterPlatform(); // may not be done by reflection on NativeAOT + Window.PrioritizeGlfw(); + } /// /// Gets a value indicating whether the given view is a GLFW view.