Dynamic window resizing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user