diff --git a/src/raylib.h b/src/raylib.h index 4f3e35380..b4c18bbde 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -979,6 +979,7 @@ RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specifi RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor +RLAPI Vector2 GetFrameBufferSize(void); // Get the actual frame buffer size regardless of DPI mode 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 RLAPI const char *GetClipboardText(void); // Get clipboard text content diff --git a/src/rcore.c b/src/rcore.c index fcb222bb3..39b3b79b3 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2117,6 +2117,21 @@ Vector2 GetWindowScaleDPI(void) return scale; } +// Get the actual frame buffer size regardless of DPI mode +RLAPI Vector2 GetFrameBufferSize(void) +{ + Vector2 size = { (float)CORE.Window.currentFbo.width, (float)CORE.Window.currentFbo.height }; +#if defined(PLATFORM_DESKTOP) + int w = 0; + int h = 0; + + glfwGetFramebufferSize(glfwGetCurrentContext(), &w, &h); + size = (Vector2){ (float)w, (float)h }; +#endif + + return size; +} + // Get the human-readable, UTF-8 encoded name of the selected monitor const char *GetMonitorName(int monitor) {