Skip to content

Commit

Permalink
Add GetMonitorScale() for PLATFORM_WEB
Browse files Browse the repository at this point in the history
  • Loading branch information
asdqwe committed Nov 20, 2024
1 parent ab79cdb commit 0969f51
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 @@ -754,8 +754,11 @@ int GetMonitorRefreshRate(int monitor)
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() 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;
}

// Get the human-readable, UTF-8 encoded name of the selected monitor
Expand Down

0 comments on commit 0969f51

Please sign in to comment.