Skip to content

Commit

Permalink
Add implementation to GetWindowScaleDPI() for PLATFORM_WEB (#4526)
Browse files Browse the repository at this point in the history
  • Loading branch information
asdqwe authored Nov 22, 2024
1 parent 0d39e71 commit a53a895
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/platforms/rcore_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,11 @@ Vector2 GetWindowPosition(void)
// Get window scale DPI factor for current monitor
Vector2 GetWindowScaleDPI(void)
{
TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform");
return (Vector2){ 1.0f, 1.0f };
// NOTE: Returned scale is relative to the current monitor where the browser window is located
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
Expand Down

0 comments on commit a53a895

Please sign in to comment.