public Monitor[] GetMonitors() { unsafe { void **ptr = (void **)glfwGetMonitors(out var count).ToPointer(); var monitors = new GlfwMonitor[count]; for (int index = 0; index < count; index++) { monitors[index] = new GlfwMonitor(new IntPtr(*ptr)); ptr++; } return(monitors); } }
private void Initialize() { if (Initialized) return; OperatingSystem OS = System.Environment.OSVersion; if (OS.Platform == PlatformID.Unix) { Glfw.WindowHint(Glfw.Hint.ContextVersionMajor, 3); Glfw.WindowHint(Glfw.Hint.ContextVersionMinor, 2); Glfw.WindowHint(Glfw.Hint.OpenglForwardCompat, 1); Glfw.WindowHint(Glfw.Hint.OpenglProfile, Glfw.OpenGLProfile.Core); } Glfw.WindowHint(Glfw.Hint.Samples, 4); Glfw.WindowHint(Glfw.Hint.Visible, false); Glfw.WindowHint((Glfw.Hint)Glfw.WindowAttrib.Resizable, true); GlfwMonitor primaryMonitor = (Monitor ?? Environment.Platform.MainMonitor) as GlfwMonitor; Glfw.Monitor monitor = Fullscreen ? primaryMonitor.Handle : Glfw.Monitor.None; Glfw.Window Shared = SharedContext?.Handle ?? Glfw.Window.None; Handle = Glfw.CreateWindow(Size.Width, Size.Height, Title, monitor, Shared); Glfw.MakeContextCurrent(Handle); // - Screen center Position = (primaryMonitor.CurrentResolution.ResolutionSize - Size) / 2; Initialized = true; InitializePositionEvents(); // InitializeDragDrop(); Glfw.MakeContextCurrent(Glfw.Window.None); }