From 16e0c9a95ec956ffd1ae1e2f2c868436aab5c444 Mon Sep 17 00:00:00 2001 From: Quinn Date: Wed, 18 Jun 2025 13:28:03 +0200 Subject: [PATCH] use vec2 to store window position --- src/io/render.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/io/render.c b/src/io/render.c index 0f5743e..acd2675 100644 --- a/src/io/render.c +++ b/src/io/render.c @@ -8,7 +8,9 @@ #include #include "../error.h" +#include "../util/vec/int2.h" #include "shader.h" +#include "window.h" #define VERTC 3 static GLuint pipe; @@ -68,10 +70,10 @@ void render_update(GLFWwindow* win) { glfwGetWindowSize(win, &w, &h); glUseProgram(pipe); - static int d = -1; // initialize d to an impossible value so the condition below is always true on first execution - if ((h ^ w) != d) { // false negative when h and w swap integers, but this is quite a rare occurrence and it's impact is minimal - screen_resize(w, h); - d = h ^ w; + int2 windim = {0}; + if (w != windim.x || h != windim.y) { // false negative when h and w swap integers, but this is quite a rare occurrence and it's impact is minimal + windim = (int2){w, h}; + screen_resize(windim.x, windim.y); } glClearColor(0.1F, 0.1F, 0.1F, 1.0F);