From 66194d26fc9e797a59e3927c89f110ffd4d4fe1c Mon Sep 17 00:00:00 2001 From: Paulo Feodrippe Date: Fri, 3 May 2024 01:33:57 -0400 Subject: [PATCH] Expose FBO aspect So we can customize the 3d mode if desired. --- src/raylib.h | 1 + src/rcore.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/raylib.h b/src/raylib.h index 035f6f2bf..f3ab9d4b6 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -988,6 +988,7 @@ 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 float GetCurrentAspect(); // Get current aspect (from the current FBO) 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 b229589f7..3225276ec 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -788,6 +788,12 @@ int GetRenderHeight(void) return height; } +// Get current aspect (from the current FBO) +float GetCurrentAspect() +{ + return (float)CORE.Window.currentFbo.width/(float)CORE.Window.currentFbo.height; +} + // Enable waiting for events on EndDrawing(), no automatic event polling void EnableEventWaiting(void) {