From e6e6b04d1318c8abfc87cb44ce146fa7ddb79bbe Mon Sep 17 00:00:00 2001 From: electric-gecko Date: Wed, 3 Apr 2024 22:02:34 -0700 Subject: [PATCH] Added `GetScreenSize` function to return screen width & height as a `Vector2`. --- src/raylib.h | 1 + src/rcore.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index 0d862a022..b1b75161c 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -986,6 +986,7 @@ RLAPI void SetWindowFocused(void); // Set window RLAPI void *GetWindowHandle(void); // Get native window handle RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenHeight(void); // Get current screen height +RLAPI Vector2 GetScreenSize(void); // Get current screen width and height as a Vector2 RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI) RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI) RLAPI int GetMonitorCount(void); // Get number of connected monitors diff --git a/src/rcore.c b/src/rcore.c index 9705495ee..79f5447f3 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -762,6 +762,12 @@ int GetScreenHeight(void) return CORE.Window.screen.height; } +// Get current screen width and height as a Vector2 +Vector2 GetScreenSize(void) +{ + return (Vector2){ (float)CORE.Window.screen.width, (float)CORE.Window.screen.height }; +} + // Get current render width which is equal to screen width*dpi scale int GetRenderWidth(void) {