Expose a function to get the frame buffer size from GLFW.

This commit is contained in:
Jeff Myers 2023-09-08 08:46:43 -07:00
parent 1896268775
commit 1e612f2f4b
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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)
{