aboutsummaryrefslogtreecommitdiff
path: root/src/window
diff options
context:
space:
mode:
Diffstat (limited to 'src/window')
-rw-r--r--src/window/window.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/window/window.c b/src/window/window.c
index 44e0a23..f975c1e 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -29,14 +29,13 @@ static void set_vertical_sync_enabled(Window window, int enabled) {
}
static void mgl_window_on_resize(mgl_window *self, int width, int height) {
- mgl_context *context = mgl_get_context();
self->size.x = width;
self->size.y = height;
mgl_view view;
view.position = (mgl_vec2i){ 0, 0 };
view.size = self->size;
- mgl_window_set_view(self, &view, NULL);
+ mgl_window_set_view(self, &view);
}
int mgl_window_create(mgl_window *self, const char *title, int width, int height) {
@@ -289,10 +288,7 @@ void mgl_window_display(mgl_window *self) {
context->gl.glXSwapBuffers(context->connection, self->window);
}
-void mgl_window_set_view(mgl_window *self, mgl_view *new_view, mgl_view *prev_view) {
- if(prev_view)
- *prev_view = self->view;
-
+void mgl_window_set_view(mgl_window *self, mgl_view *new_view) {
mgl_context *context = mgl_get_context();
self->view = *new_view;
context->gl.glViewport(new_view->position.x, self->size.y - new_view->size.y - new_view->position.y, new_view->size.x, new_view->size.y);
@@ -300,3 +296,7 @@ void mgl_window_set_view(mgl_window *self, mgl_view *new_view, mgl_view *prev_vi
context->gl.glLoadIdentity();
context->gl.glOrtho(0.0, new_view->size.x, new_view->size.y, 0.0, 0.0, 1.0);
}
+
+void mgl_window_get_view(mgl_window *self, mgl_view *view) {
+ *view = self->view;
+}