diff options
| author | ubkp <[email protected]> | 2023-12-15 12:24:45 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-15 16:24:45 +0100 |
| commit | 489f0b93f9cbb05af889a3412a8490d6640168c0 (patch) | |
| tree | 1575d9dc9083a0c1c8ff8724c858b4c41f4a54cb /src | |
| parent | 1e7b99562a398cf5a41fda557297a41f65aeb1f4 (diff) | |
| download | raylib-489f0b93f9cbb05af889a3412a8490d6640168c0.tar.gz raylib-489f0b93f9cbb05af889a3412a8490d6640168c0.zip | |
[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
Diffstat (limited to 'src')
| -rw-r--r-- | src/platforms/rcore_web.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/platforms/rcore_web.c b/src/platforms/rcore_web.c index 57fd7656..6387420f 100644 --- a/src/platforms/rcore_web.c +++ b/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 |
