From c89d178e8d4ba6b2c5fcf157b21b5b2c51517208 Mon Sep 17 00:00:00 2001 From: MichaelFiber Date: Mon, 18 Sep 2023 16:15:21 -0400 Subject: [PATCH] Move GetMonitorPhysicalWidth from rcore to submodule --- src/rcore.c | 18 ------------------ src/rcore_android.c | 7 +++++++ src/rcore_desktop.c | 17 +++++++++++++++++ src/rcore_drm.c | 7 +++++++ src/rcore_web.c | 7 +++++++ 5 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 7067f887a..23f4f7790 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -410,24 +410,6 @@ int GetRenderHeight(void) return CORE.Window.render.height; } -// Get selected monitor physical width in millimetres -int GetMonitorPhysicalWidth(int monitor) -{ -#if defined(PLATFORM_DESKTOP) - int monitorCount; - GLFWmonitor **monitors = glfwGetMonitors(&monitorCount); - - if ((monitor >= 0) && (monitor < monitorCount)) - { - int physicalWidth; - glfwGetMonitorPhysicalSize(monitors[monitor], &physicalWidth, NULL); - return physicalWidth; - } - else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor"); -#endif - return 0; -} - // Enable waiting for events on EndDrawing(), no automatic event polling void EnableEventWaiting(void) { diff --git a/src/rcore_android.c b/src/rcore_android.c index 55fba1af6..c336009e6 100644 --- a/src/rcore_android.c +++ b/src/rcore_android.c @@ -1633,3 +1633,10 @@ const char *GetGamepadName(int gamepad) { return NULL; } + + +// Get selected monitor physical width in millimetres +int GetMonitorPhysicalWidth(int monitor) +{ + return 0; +} diff --git a/src/rcore_desktop.c b/src/rcore_desktop.c index 9f230fbb5..754a3668f 100644 --- a/src/rcore_desktop.c +++ b/src/rcore_desktop.c @@ -1507,3 +1507,20 @@ const char *GetGamepadName(int gamepad) return name; } + + +// Get selected monitor physical width in millimetres +int GetMonitorPhysicalWidth(int monitor) +{ + int monitorCount; + GLFWmonitor **monitors = glfwGetMonitors(&monitorCount); + + if ((monitor >= 0) && (monitor < monitorCount)) + { + int physicalWidth; + glfwGetMonitorPhysicalSize(monitors[monitor], &physicalWidth, NULL); + return physicalWidth; + } + else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor"); + return 0; +} diff --git a/src/rcore_drm.c b/src/rcore_drm.c index 9ae82d598..193f2335f 100644 --- a/src/rcore_drm.c +++ b/src/rcore_drm.c @@ -955,3 +955,10 @@ const char *GetGamepadName(int gamepad) return name; } + + +// Get selected monitor physical width in millimetres +int GetMonitorPhysicalWidth(int monitor) +{ + return 0; +} diff --git a/src/rcore_web.c b/src/rcore_web.c index 48fb7e260..9e9deb5ca 100644 --- a/src/rcore_web.c +++ b/src/rcore_web.c @@ -1555,3 +1555,10 @@ const char *GetGamepadName(int gamepad) return name; } + + +// Get selected monitor physical width in millimetres +int GetMonitorPhysicalWidth(int monitor) +{ + return 0; +}