public void CreateWindow() { var monitor = isFullscreen ? Glfw.GetPrimaryMonitor() : GlfwMonitorPtr.Null; var currentWindow = Glfw.CreateWindow(Width, Height, Title, monitor, window); Glfw.SetKeyCallback(currentWindow, new GlfwKeyFun((w, key, scancode, action, modifiers) => { var info = new PencilKeyInfo(key, scancode, action, modifiers); onKeyboard.Fire(info); })); Glfw.SetWindowCloseCallback(currentWindow, new GlfwWindowCloseFun(w => { Exit(); })); Glfw.SetWindowSizeCallback(currentWindow, new GlfwWindowSizeFun((w, width, height) => { this.width = width; this.height = height; onWindowResized.Fire(this); })); Glfw.SwapInterval(shouldVsync ? 1 : 0); Glfw.MakeContextCurrent(currentWindow); if (!firstTime) { Glfw.SetWindowShouldClose(window, true); } window = currentWindow; rebuiltWindow = true; onWindowOpened.Fire(this); firstTime = false; }
public void CreateWindow() { var monitor = isFullscreen ? Glfw.GetPrimaryMonitor() : GlfwMonitorPtr.Null; var currentWindow = Glfw.CreateWindow(Width, Height, Title, monitor, window); Glfw.SetKeyCallback(currentWindow, new GlfwKeyFun((w, key, scancode, action, modifiers) => { var info = new PencilKeyInfo(key, scancode, action, modifiers); onKeyboard.Fire(info); })); Glfw.SetWindowCloseCallback(currentWindow, new GlfwWindowCloseFun(w => { Exit(); })); Glfw.SetWindowSizeCallback(currentWindow, new GlfwWindowSizeFun((w, width, height) => { this.width = width; this.height = height; onWindowResized.Fire(this); })); Glfw.SwapInterval(shouldVsync ? 1 : 0); Glfw.MakeContextCurrent(currentWindow); if(!firstTime) Glfw.SetWindowShouldClose(window, true); window = currentWindow; rebuiltWindow = true; onWindowOpened.Fire(this); firstTime = false; }