summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 8aaed26..2ab34c6 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -447,12 +447,21 @@ void DestroySwapchain() {
swapchainImageViews = reinterpret_cast<VkImageView *>(0xCAFEBABE);
}
+void FramebufferResizeCallback(GLFWwindow *window, int width, int height) {
+ if (extent.width == width && extent.height != height) {
+ return;
+ }
+ DestroySwapchain();
+ CreateSwapchain();
+}
+
void CreateWindow(PKEWindowProperties *wp) {
if (vkInstance != nullptr) return;
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
window = glfwCreateWindow(wp->width, wp->height, "Pikul", nullptr, nullptr);
InitVulkan();
+ glfwSetFramebufferSizeCallback(window, FramebufferResizeCallback);
CreateSwapchain();
}