window resizing
This commit is contained in:
@ -6,6 +6,7 @@ Window::Window(int width, int height, const char* title) {
|
|||||||
throw ("Failed to create GLFW Window!");
|
throw ("Failed to create GLFW Window!");
|
||||||
setSize(width, height);
|
setSize(width, height);
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
|
glfwSetFramebufferSizeCallback(glfw_window, onResize);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,4 +124,9 @@ void Window::endRender() {
|
|||||||
|
|
||||||
bool Window::isClosing() {
|
bool Window::isClosing() {
|
||||||
return glfwWindowShouldClose(glfw_window);
|
return glfwWindowShouldClose(glfw_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::onResize(GLFWwindow* window, int width, int height) {
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
@ -35,5 +35,7 @@ public:
|
|||||||
void beginRender();
|
void beginRender();
|
||||||
void endRender();
|
void endRender();
|
||||||
bool isClosing();
|
bool isClosing();
|
||||||
|
private:
|
||||||
|
static void onResize(GLFWwindow* window, int width, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user