浏览代码

Add GetMonitorScale() for PLATFORM_WEB

pull/4525/head
asdqwe 4 个月前
父节点
当前提交
0969f51298
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      src/platforms/rcore_web.c

+ 5
- 2
src/platforms/rcore_web.c 查看文件

@ -754,8 +754,11 @@ int GetMonitorRefreshRate(int monitor)
// Get specified monitor scale // Get specified monitor scale
Vector2 GetMonitorScale(int monitor) 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 // Get the human-readable, UTF-8 encoded name of the selected monitor

正在加载...
取消
保存