From 6a899fa1f78203e2c29c308ccaf4a66c27d42561 Mon Sep 17 00:00:00 2001 From: Chris <48462986+turnerdev@users.noreply.github.com> Date: Thu, 11 May 2023 22:28:05 -0700 Subject: [PATCH] Get client width & height --- src/raylib.h | 2 ++ src/rcore.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index 2a5a2f63f..137c7f1a6 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -955,6 +955,8 @@ RLAPI int GetScreenWidth(void); // Get current RLAPI int GetScreenHeight(void); // Get current screen height RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI) RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI) +RLAPI int GetClientWidth(void); // Get current client width +RLAPI int GetClientHeight(void); // Get current client height RLAPI int GetMonitorCount(void); // Get number of connected monitors RLAPI int GetCurrentMonitor(void); // Get current connected monitor RLAPI Vector2 GetMonitorPosition(int monitor); // Get specified monitor position diff --git a/src/rcore.c b/src/rcore.c index 476ea8e2f..bb5e99e63 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1694,6 +1694,22 @@ int GetScreenHeight(void) return CORE.Window.screen.height; } +// Get current client width +int GetClientWidth(void) +{ + int width; + glfwGetWindowSize(CORE.Window.handle, &width, NULL); + return width; +} + +// Get current client height +int GetClientHeight(void) +{ + int height; + glfwGetWindowSize(CORE.Window.handle, NULL, &height); + return height; +} + // Get current render width which is equal to screen width * dpi scale int GetRenderWidth(void) {