From 735bea5636ec23cad61145dcaebddb0f1f056d9e Mon Sep 17 00:00:00 2001 From: Jeffery Myers Date: Tue, 29 Dec 2020 14:36:58 -0800 Subject: [PATCH] lookup the returned monitor in the list of monitors to get an index. --- src/core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 905367c9c..39525d882 100644 --- a/src/core.c +++ b/src/core.c @@ -1456,7 +1456,16 @@ int GetMonitorCount(void) int GetCurrentMonitor(void) { #if defined(PLATFORM_DESKTOP) - return glfwGetWindowMonitor(CORE.Window.handle); + int monitorCount; + GLFWmonitor** monitors = glfwGetMonitors(&monitorCount); + + GLFWmonitor* monitor = glfwGetWindowMonitor(CORE.Window.handle); + for (int i = 0; i < monitorCount; i++) + { + if (monitors[i] == monitor) + return i; + } + return 0; #else return 0; #endif