Dynamic window resizing

This commit is contained in:
2026-02-20 21:25:33 +00:00
parent e4124c0aaf
commit 11783743de
9 changed files with 143 additions and 60 deletions

View File

@@ -20,6 +20,8 @@ namespace cve {
window = glfwCreateWindow(width, height,
windowName.c_str(), nullptr, nullptr);
glfwSetWindowUserPointer(window, this);
glfwSetFramebufferSizeCallback(window, framebufferResizedCallback);
}
void CveWindow::createWindowSurface(VkInstance instance, VkSurfaceKHR *surface) {
@@ -27,4 +29,11 @@ namespace cve {
throw std::runtime_error("Failed to create window surface");
}
}
void CveWindow::framebufferResizedCallback(GLFWwindow *window, int width, int height) {
auto cveWindow = reinterpret_cast<CveWindow *>(glfwGetWindowUserPointer(window));
cveWindow->framebufferResized = true;
cveWindow->width = width;
cveWindow->height = height;
}
}