/// <summary> /// Create a Surface object for a GLFW3 window. /// </summary> /// <param name="instance"></param> /// <param name="window"></param> /// <returns></returns> public unsafe static Surface CreateGlfw3Surface(this Instance instance, Window window) { Result result = Glfw3.CreateWindowSurface(instance.RawHandle, window.handle, null, out ulong surfaceHandle); if (SharpVkException.IsError(result)) { throw SharpVkException.Create(result); } return(Surface.CreateFromHandle(instance, surfaceHandle)); }
public InputAction GetMouseButtonState(MouseButton mouseButton) { try { ErrorUtility.Bind(); InputAction result = Glfw3.GetMouseButton(this.handle, mouseButton); ErrorUtility.ThrowOnError(); return(result); } finally { ErrorUtility.Unbind(); } }
public InputAction GetKeyState(Key key) { try { ErrorUtility.Bind(); InputAction result = Glfw3.GetKey(this.handle, key); ErrorUtility.ThrowOnError(); return(result); } finally { ErrorUtility.Unbind(); } }
/// <summary> /// Closes the window. /// </summary> public void Close() { if (!this.isDisposed) { try { ErrorUtility.Bind(); Glfw3.DestroyWindow(this.handle); this.isDisposed = true; ErrorUtility.ThrowOnError(); } finally { ErrorUtility.Unbind(); } } }
internal Window(int width, int height, string title, MonitorHandle monitor, Dictionary <WindowAttribute, int> windowHints) { try { ErrorUtility.Bind(); if (windowHints != null) { foreach (var hintPair in windowHints) { Glfw3.WindowHint(hintPair.Key, hintPair.Value); } } this.handle = Glfw3.CreateWindow(width, height, title, monitor, WindowHandle.Zero); ErrorUtility.ThrowOnError(); } finally { ErrorUtility.Unbind(); } }
public Window(int width, int height, string title) { this.handle = Glfw3.CreateWindow(width, height, title, IntPtr.Zero, IntPtr.Zero); }