GetScreenCenter

New function "GetScreenCenter" returns the width and the height of the window divided by two.
This commit is contained in:
Matorio 2025-12-06 23:41:30 -05:00
parent 3101ab4079
commit 51bf8d0820
2 changed files with 12 additions and 0 deletions

View File

@ -1002,6 +1002,7 @@ RLAPI void SetWindowFocused(void); // Set window
RLAPI void *GetWindowHandle(void); // Get native window handle RLAPI void *GetWindowHandle(void); // Get native window handle
RLAPI int GetScreenWidth(void); // Get current screen width RLAPI int GetScreenWidth(void); // Get current screen width
RLAPI int GetScreenHeight(void); // Get current screen height RLAPI int GetScreenHeight(void); // Get current screen height
RLAPI Vector2 GetScreenCenter(void); // Get the center of the current screen
RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI) RLAPI int GetRenderWidth(void); // Get current render width (it considers HiDPI)
RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI) RLAPI int GetRenderHeight(void); // Get current render height (it considers HiDPI)
RLAPI int GetMonitorCount(void); // Get number of connected monitors RLAPI int GetMonitorCount(void); // Get number of connected monitors

View File

@ -819,6 +819,17 @@ int GetScreenHeight(void)
return CORE.Window.screen.height; return CORE.Window.screen.height;
} }
// Get the center of the current screen
Vector2 GetScreenCenter(void)
{
Vector2 center = (Vector2)
{
GetScreenWidth() / 2.0f,
GetScreenHeight() / 2.0f
};
return center;
}
// Get current render width which is equal to screen width*dpi scale // Get current render width which is equal to screen width*dpi scale
int GetRenderWidth(void) int GetRenderWidth(void)
{ {