From dce6d5c8cb4bc8df5f1bfd5f83a142d88a71e5f2 Mon Sep 17 00:00:00 2001 From: ubkp <118854183+ubkp@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:52:19 -0300 Subject: [PATCH] Add GetWindowSize() function --- src/raylib.h | 1 + src/rcore.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index 108ab0245..beedbc1fa 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -973,6 +973,7 @@ RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specifi RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor +RLAPI Vector2 GetWindowSize(void); // Get window size 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 specified monitor RLAPI void SetClipboardText(const char *text); // Set clipboard text content diff --git a/src/rcore.c b/src/rcore.c index d6aeaec96..29b1425f7 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1972,6 +1972,17 @@ Vector2 GetWindowPosition(void) return (Vector2){ (float)x, (float)y }; } +// Get window size on monitor +Vector2 GetWindowSize(void) +{ + int x = 0; + int y = 0; +#if defined(PLATFORM_DESKTOP) + glfwGetWindowSize(CORE.Window.handle, &x, &y); +#endif + return (Vector2){ (float)x, (float)y }; +} + // Get window scale DPI factor for current monitor Vector2 GetWindowScaleDPI(void) {