diff options
| author | Jeffery Myers <[email protected]> | 2020-12-05 12:51:20 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-05 21:51:20 +0100 |
| commit | 03df593263b289bc07188a2d925d74a0e7ec631d (patch) | |
| tree | e8052272d226c49be24cb6ba0e0004f9656ac9ea /src/core.c | |
| parent | 62406259d755d97324aec0856fc637d628d3df22 (diff) | |
| download | raylib-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.c | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -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) |
