use vec2 to store window position

This commit is contained in:
2025-06-18 13:28:03 +02:00
parent 9de057112b
commit 16e0c9a95e

View File

@@ -8,7 +8,9 @@
#include <stdint.h> #include <stdint.h>
#include "../error.h" #include "../error.h"
#include "../util/vec/int2.h"
#include "shader.h" #include "shader.h"
#include "window.h"
#define VERTC 3 #define VERTC 3
static GLuint pipe; static GLuint pipe;
@@ -68,10 +70,10 @@ void render_update(GLFWwindow* win) {
glfwGetWindowSize(win, &w, &h); glfwGetWindowSize(win, &w, &h);
glUseProgram(pipe); glUseProgram(pipe);
static int d = -1; // initialize d to an impossible value so the condition below is always true on first execution int2 windim = {0};
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 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
screen_resize(w, h); windim = (int2){w, h};
d = h ^ w; screen_resize(windim.x, windim.y);
} }
glClearColor(0.1F, 0.1F, 0.1F, 1.0F); glClearColor(0.1F, 0.1F, 0.1F, 1.0F);