From a0aa0a1d3d07b1f95bb9f8b47dba3d3dfb67b9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Tue, 10 Oct 2023 16:26:17 +0200 Subject: [PATCH] window: add window_dpi() --- bind/v4k.lua | 4 ++++ engine/joint/v4k.h | 7 +++++++ engine/split/v4k_window.c | 6 ++++++ engine/split/v4k_window.h | 1 + engine/v4k.c | 6 ++++++ engine/v4k.h | 1 + 6 files changed, 25 insertions(+) diff --git a/bind/v4k.lua b/bind/v4k.lua index 5dfe7b8..29dceeb 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -1505,6 +1505,9 @@ ffi.cdef([[ //lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 window_canvas(); //lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 window_canvas(); //lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 window_canvas(); +//lcpp INF [0000] vec2: macro name but used as C declaration in:API vec2 window_dpi(); +//lcpp INF [0000] vec2: macro name but used as C declaration in:STATIC vec2 window_dpi(); +//lcpp INF [0000] vec2: macro name but used as C declaration in: vec2 window_dpi(); typedef struct FILE FILE; typedef long int ptrdiff_t; typedef long unsigned int size_t; @@ -3190,6 +3193,7 @@ WINDOW_VSYNC_DISABLED =8192, uint64_t window_frame(); int window_width(); int window_height(); + vec2 window_dpi(); double window_time(); double window_delta(); void window_focus(); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index d284898..3da5c2d 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17984,6 +17984,7 @@ API char* window_stats(); API uint64_t window_frame(); API int window_width(); API int window_height(); +API vec2 window_dpi(); API double window_time(); API double window_delta(); @@ -605770,6 +605771,12 @@ double window_time() { double window_delta() { return dt; } +vec2 window_dpi() { + float x=0.0f; + float y=0.0f; + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); + return vec2(x,y); +} double window_fps() { return fps; diff --git a/engine/split/v4k_window.c b/engine/split/v4k_window.c index 83fcb73..278667c 100644 --- a/engine/split/v4k_window.c +++ b/engine/split/v4k_window.c @@ -813,6 +813,12 @@ double window_time() { double window_delta() { return dt; } +vec2 window_dpi() { + float x=0.0f; + float y=0.0f; + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); + return vec2(x,y); +} double window_fps() { return fps; diff --git a/engine/split/v4k_window.h b/engine/split/v4k_window.h index e662a06..90ab033 100644 --- a/engine/split/v4k_window.h +++ b/engine/split/v4k_window.h @@ -45,6 +45,7 @@ API char* window_stats(); API uint64_t window_frame(); API int window_width(); API int window_height(); +API vec2 window_dpi(); API double window_time(); API double window_delta(); diff --git a/engine/v4k.c b/engine/v4k.c index 3c45db0..08fd6ed 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -23944,6 +23944,12 @@ double window_time() { double window_delta() { return dt; } +vec2 window_dpi() { + float x=0.0f; + float y=0.0f; + glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &x, &y); + return vec2(x,y); +} double window_fps() { return fps; diff --git a/engine/v4k.h b/engine/v4k.h index e171346..03f998f 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -4051,6 +4051,7 @@ API char* window_stats(); API uint64_t window_frame(); API int window_width(); API int window_height(); +API vec2 window_dpi(); API double window_time(); API double window_delta();