瀏覽代碼

[rcore] Add `GetWindowPosition()` implementation for `PLATFORM_WEB` and fixes #3636 style/format (#3637)

* Add GetWindowPosition() implementation for PLATFORM_WEB and fixes #3636 style/format

* Remove double space
pull/3642/head
ubkp 1 年之前
committed by GitHub
父節點
當前提交
489f0b93f9
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 13 行新增8 行删除
  1. +13
    -8
      src/platforms/rcore_web.c

+ 13
- 8
src/platforms/rcore_web.c 查看文件

@ -572,17 +572,19 @@ Vector2 GetMonitorPosition(int monitor)
// Get selected monitor width (currently used by monitor)
int GetMonitorWidth(int monitor)
{
int w = 0;
w = EM_ASM_INT( { return screen.width; }, 0);
return w;
// NOTE: Returned value is limited to the current monitor where the browser window is located
int width = 0;
width = EM_ASM_INT( { return screen.width; }, 0);
return width;
}
// Get selected monitor height (currently used by monitor)
int GetMonitorHeight(int monitor)
{
int h = 0;
h = EM_ASM_INT( { return screen.height; }, 0);
return h;
// NOTE: Returned value is limited to the current monitor where the browser window is located
int height = 0;
height = EM_ASM_INT( { return screen.height; }, 0);
return height;
}
// Get selected monitor physical width in millimetres
@ -616,8 +618,11 @@ const char *GetMonitorName(int monitor)
// Get window position XY on monitor
Vector2 GetWindowPosition(void)
{
TRACELOG(LOG_WARNING, "GetWindowPosition() not implemented on target platform");
return (Vector2){ 0, 0 };
// NOTE: Returned position is relative to the current monitor where the browser window is located
Vector2 position = { 0, 0 };
position.x = (float)EM_ASM_INT( { return window.screenX; }, 0);
position.y = (float)EM_ASM_INT( { return window.screenY; }, 0);
return position;
}
// Get window scale DPI factor for current monitor

Loading…
取消
儲存