Bladeren bron

Add a current monitor function for window mode windows. (#1492)

pull/1493/head
Jeffery Myers 4 jaren geleden
committed by GitHub
bovenliggende
commit
4c8bebc0d7
Geen bekende sleutel gevonden voor deze handtekening in de database GPG sleutel-ID: 4AEE18F83AFDEB23
1 gewijzigde bestanden met toevoegingen van 33 en 4 verwijderingen
  1. +33
    -4
      src/core.c

+ 33
- 4
src/core.c Bestand weergeven

@ -1458,12 +1458,41 @@ int GetCurrentMonitor(void)
#if defined(PLATFORM_DESKTOP)
int monitorCount;
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
GLFWmonitor* monitor = NULL;
GLFWmonitor* monitor = glfwGetWindowMonitor(CORE.Window.handle);
for (int i = 0; i < monitorCount; i++)
if (monitorCount == 1) // easy out
return 0;
if (IsWindowFullscreen())
{
monitor = glfwGetWindowMonitor(CORE.Window.handle);
for (int i = 0; i < monitorCount; i++)
{
if (monitors[i] == monitor)
return i;
}
return 0;
}
else
{
if (monitors[i] == monitor)
return i;
int x = 0;
int y = 0;
glfwGetWindowPos(CORE.Window.handle, &x, &y);
for (int i = 0; i < monitorCount; i++)
{
int mx = 0;
int my = 0;
int width = 0;
int height = 0;
monitor = monitors[i];
glfwGetMonitorWorkarea(monitor, &mx, &my, &width, &height);
if (x >= mx && x <= (mx + width) && y >= my && y <= (my + height))
return i;
}
}
return 0;
#else

Laden…
Annuleren
Opslaan