public static MonitorPtr GetWindowMonitor(WindowPtr window) { var result = glfwGetWindowMonitor(window); CheckError(); return(result); }
public static void SetWindowIcon(WindowPtr window, Image[] images) { unsafe { if (images == null || images.Length == 0) { glfwSetWindowIcon(window, 0, null); return; } NativeImage[] nimgs = new NativeImage[images.Length]; fixed(NativeImage *ptr = &nimgs[0]) { for (int i = 0; i < images.Length; i++) { fixed(byte *data = &images[i].data[0]) { nimgs[i] = new NativeImage(images[i].width, images[i].height, data); } } glfwSetWindowIcon(window, images.Length, ptr); CheckError(); } } }
public static void SetWindowSizeLimits(WindowPtr window, int minWidth, int minHeight, int maxWidth, int maxHeight) { glfwSetWindowSizeLimits(window, minWidth, minHeight, maxWidth, maxHeight); CheckError(); }
void CreateWindow() { GLFW.WindowHint(WindowHint.ClientAPI, (int)ClientAPI.NoAPI); window = GLFW.CreateWindow(height, width, "Hello Triangle", MonitorPtr.Null, WindowPtr.Null); GLFW.SetWindowSizeCallback(window, OnWindowResized); }
public static bool WindowShouldClose(WindowPtr window) { var result = glfwWindowShouldClose(window); CheckError(); return(result); }
public static void SetWindowMonitor(WindowPtr window, MonitorPtr monitor, int x, int y, int width, int height, int refreshRate) { glfwSetWindowMonitor(window, monitor, x, y, width, height, refreshRate); CheckError(); }
void OnWindowResized(WindowPtr window, int width, int height) { if (width == 0 || height == 0) { return; } recreateSwapchainFlag = true; }
void CreateSurface(WindowPtr window) { var result = (VkResult)GLFW.GLFW.CreateWindowSurface(Instance.Native.native, window, Instance.AllocationCallbacks, out surface.native); if (result != VkResult.Success) { throw new SurfaceException(string.Format("Error creating surface: {0}", result)); } }
public Surface(PhysicalDevice device, WindowPtr window) { if (device == null) { throw new ArgumentNullException(nameof(device)); } if (window == WindowPtr.Null) { throw new ArgumentNullException(nameof(window)); } Init(device, window); }
void Init(PhysicalDevice device, WindowPtr window) { physicalDevice = device; Instance = device.Instance; getCapabilities = Instance.Commands.getCapabilities; getFormats = Instance.Commands.getFormats; getModes = Instance.Commands.getModes; CreateSurface(window); GetFormats(); GetModes(); }
public static GLWindow GetCurrentContext() { lock (windowMap) { WindowPtr ptr = GLFW.GLFW.GetCurrentContext(); //current context may not have been created with this class, return null in that case if (windowMap.ContainsKey(ptr)) { return(windowMap[GLFW.GLFW.GetCurrentContext()]); } else { return(null); } } }