From 5636ca1267907467ea4a70bbeddc8aec46bd487d Mon Sep 17 00:00:00 2001 From: Hristo Stamenov Date: Tue, 29 Dec 2020 10:56:49 +0200 Subject: [PATCH] Added a new utility function to get the current monitor. Some of the other functions rely on passing on a monitor id but we only have a function for querying the count of monitors available. --- src/core.c | 10 ++++++++++ src/raylib.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/core.c b/src/core.c index e6d27e5f9..8a00a3906 100644 --- a/src/core.c +++ b/src/core.c @@ -1452,6 +1452,16 @@ int GetMonitorCount(void) #endif } +// Get number of monitors +int GetCurrentMonitor(void) +{ +#if defined(PLATFORM_DESKTOP) + return glfwGetWindowMonitor(CORE.Window.handle); +#else + return 0; +#endif +} + // Get selected monitor width Vector2 GetMonitorPosition(int monitor) { diff --git a/src/raylib.h b/src/raylib.h index 031640b12..204513c66 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -916,6 +916,7 @@ RLAPI void *GetWindowHandle(void); // Get native RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height RLAPI int GetMonitorCount(void); // Get number of connected monitors +RLAPI int GetCurrentMonitor(void); // Get number of connected monitors RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position RLAPI int GetMonitorWidth(int monitor); // Get specified monitor width RLAPI int GetMonitorHeight(int monitor); // Get specified monitor height