lookup the returned monitor in the list of monitors to get an index. (#1490)

This commit is contained in:
Jeffery Myers 2020-12-29 15:08:56 -08:00 committed by GitHub
parent 22b179e66c
commit 24b6dcf29f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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