Add implementation to GetWindowScaleDPI() for PLATFORM_WEB (#4526)

This commit is contained in:
Asdqwe 2024-11-22 06:52:55 -03:00 committed by GitHub
parent 0d39e7137b
commit a53a8958f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -771,8 +771,11 @@ Vector2 GetWindowPosition(void)
// Get window scale DPI factor for current monitor // Get window scale DPI factor for current monitor
Vector2 GetWindowScaleDPI(void) Vector2 GetWindowScaleDPI(void)
{ {
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform"); // NOTE: Returned scale is relative to the current monitor where the browser window is located
return (Vector2){ 1.0f, 1.0f }; Vector2 scale = { 1.0f, 1.0f };
scale.x = (float)EM_ASM_DOUBLE( { return window.devicePixelRatio; } );
scale.y = scale.x;
return scale;
} }
// Set clipboard text content // Set clipboard text content