summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorShylie <[email protected]>2020-06-24 12:28:57 -0400
committerGitHub <[email protected]>2020-06-24 18:28:57 +0200
commit25fb24ba7d8cb90a32ae3b7a57f4a1a87a8f7319 (patch)
treedbd7a676183aaa502226a0345dca11f0c59f7ccc /src
parentbe80708d41bcf6805ba2a4031999011f52fdb9ad (diff)
downloadraylib-25fb24ba7d8cb90a32ae3b7a57f4a1a87a8f7319.tar.gz
raylib-25fb24ba7d8cb90a32ae3b7a57f4a1a87a8f7319.zip
[add] GetMonitorRefreshRate(int monitor); (#1289)
Diffstat (limited to 'src')
-rw-r--r--src/core.c16
-rw-r--r--src/raylib.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index cec7344c..e644896c 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1195,6 +1195,22 @@ int GetMonitorPhysicalHeight(int monitor)
return 0;
}
+int GetMonitorRefreshRate(int monitor)
+{
+#if defined(PLATFORM_DESKTOP)
+ int monitorCount;
+ GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
+
+ if ((monitor >= 0) && (monitor < monitorCount))
+ {
+ const GLFWvidmode *vidmode = glfwGetVideoMode(monitors[monitor]);
+ return vidmode->refreshRate;
+ }
+ else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor");
+#endif
+ return 0;
+}
+
// Get window position XY on monitor
Vector2 GetWindowPosition(void)
{
diff --git a/src/raylib.h b/src/raylib.h
index 19591bdc..3894a4a1 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -892,6 +892,7 @@ RLAPI int GetMonitorWidth(int monitor); // Get primary
RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
+RLAPI int GetMonitorRefreshRate(int monitor); // Get primary monitor refresh rate
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor