window resizing

This commit is contained in:
2025-01-03 19:44:13 -07:00
parent cec0c6fc16
commit 07c6b186d2
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Window::Window(int width, int height, const char* title) {
throw ("Failed to create GLFW Window!");
setSize(width, height);
setTitle(title);
glfwSetFramebufferSizeCallback(glfw_window, onResize);
}
@ -123,4 +124,9 @@ void Window::endRender() {
bool Window::isClosing() {
return glfwWindowShouldClose(glfw_window);
}
void Window::onResize(GLFWwindow* window, int width, int height) {
glfwMakeContextCurrent(window);
glViewport(0, 0, width, height);
}

View File

@ -35,5 +35,7 @@ public:
void beginRender();
void endRender();
bool isClosing();
private:
static void onResize(GLFWwindow* window, int width, int height);
};