make asc_ui_scale_auto() normalized with Full HD as 100%

Fri, 01 Aug 2025 17:57:39 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 01 Aug 2025 17:57:39 +0200
changeset 235
e9540bfa5803
parent 234
a1d70b8018c1
child 236
7ad67e547266

make asc_ui_scale_auto() normalized with Full HD as 100%

src/ui.c file | annotate | diff | comparison | revisions
--- a/src/ui.c	Thu Jul 31 22:14:27 2025 +0200
+++ b/src/ui.c	Fri Aug 01 17:57:39 2025 +0200
@@ -31,6 +31,8 @@
 #include "ascension/context.h"
 #include "ascension/scene.h"
 
+#include <math.h>
+
 void asc_ui_add_node(AscSceneNode *node) {
     asc_scene_add_node(&asc_active_window->ui, node);
 }
@@ -45,14 +47,7 @@
 
 float asc_ui_scale_auto(void) {
     const asc_vec2u res = asc_window_display_resolution();
-    float scale;
-    if (res.width > 3100) {
-        scale = 2.0f;
-    } else if (res.width > 2000) {
-        scale = 1.5f;
-    } else {
-        scale = 1.f;
-    }
+    float scale = roundf((float)res.height / 108.f) / 10.f;
     asc_ui_scale(scale);
     return scale;
 }

mercurial