summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorJeffery Myers <[email protected]>2020-12-05 12:51:20 -0800
committerGitHub <[email protected]>2020-12-05 21:51:20 +0100
commit03df593263b289bc07188a2d925d74a0e7ec631d (patch)
treee8052272d226c49be24cb6ba0e0004f9656ac9ea /src/core.c
parent62406259d755d97324aec0856fc637d628d3df22 (diff)
downloadraylib-03df593263b289bc07188a2d925d74a0e7ec631d.tar.gz
raylib-03df593263b289bc07188a2d925d74a0e7ec631d.zip
Add function to get the position of a monitor (and fix some comments) (#1449)
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c
index 8411c10e..12f76609 100644
--- a/src/core.c
+++ b/src/core.c
@@ -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)