Make aspect global

This commit is contained in:
2025-10-18 17:43:22 +01:00
parent 5604675ca6
commit 26b9e1da94
7 changed files with 14 additions and 21 deletions

View File

@@ -9,6 +9,8 @@
#include <unistd.h>
#include <xf86drm.h>
float aspect;
static int drm_fd;
static drmModeConnector *conn;
static drmModeCrtc *crtc;
@@ -74,7 +76,7 @@ static void draw_line(vec3_t v1, vec3_t v2)
}
}
renderer_params_t renderer_init()
int renderer_init()
{
drm_fd = open("/dev/dri/card1", O_RDWR | O_CLOEXEC);
assert(drm_fd != -1);
@@ -104,7 +106,7 @@ renderer_params_t renderer_init()
wrap = true;
const float aspect = (float)width / (float)height;
aspect = (float)width / (float)height;
const float scale = (float)height / 2.0f;
view = (mat3_t) {
{ scale, 0, 0 },
@@ -112,10 +114,7 @@ renderer_params_t renderer_init()
{ aspect * scale, scale, 1 },
};
return (renderer_params_t) {
.drm_fd = drm_fd,
.aspect = aspect,
};
return drm_fd;
}
void renderer_cleanup()