浏览代码

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

pull/4531/head
Asdqwe 3 周前
committed by GitHub
父节点
当前提交
a53a8958f2
找不到此签名对应的密钥 GPG 密钥 ID: B5690EEEBB952194
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. +5
    -2
      src/platforms/rcore_web.c

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

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

正在加载...
取消
保存