Add function to get the position of a monitor (and fix some comments) (#1449)

This commit is contained in:
Jeffery Myers
2020-12-05 12:51:20 -08:00
committed by GitHub
parent 62406259d7
commit 03df593263
2 changed files with 28 additions and 8 deletions

View File

@@ -1437,7 +1437,26 @@ int GetMonitorCount(void)
#endif
}
// Get primary monitor width
// Get selected monitor width
Vector2 GetMonitorPosition(int monitor)
{
#if defined(PLATFORM_DESKTOP)
int monitorCount;
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
if ((monitor >= 0) && (monitor < monitorCount))
{
int x, y;
glfwGetMonitorPos(monitors[monitor], &x, &y);
const GLFWvidmode* mode = glfwGetVideoMode(monitors[monitor]);
return (Vector2){ (float)x, (float)y };
}
else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor");
#endif
return (Vector2){ 0, 0 };
}
// Get selected monitor width
int GetMonitorWidth(int monitor)
{
#if defined(PLATFORM_DESKTOP)
@@ -1454,7 +1473,7 @@ int GetMonitorWidth(int monitor)
return 0;
}
// Get primary monitor width
// Get selected monitor width
int GetMonitorHeight(int monitor)
{
#if defined(PLATFORM_DESKTOP)
@@ -1471,7 +1490,7 @@ int GetMonitorHeight(int monitor)
return 0;
}
// Get primary montior physical width in millimetres
// Get selected monitor physical width in millimetres
int GetMonitorPhysicalWidth(int monitor)
{
#if defined(PLATFORM_DESKTOP)