mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-05 19:08:13 +00:00
[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
This commit is contained in:
@@ -572,17 +572,19 @@ Vector2 GetMonitorPosition(int monitor)
|
|||||||
// Get selected monitor width (currently used by monitor)
|
// Get selected monitor width (currently used by monitor)
|
||||||
int GetMonitorWidth(int monitor)
|
int GetMonitorWidth(int monitor)
|
||||||
{
|
{
|
||||||
int w = 0;
|
// NOTE: Returned value is limited to the current monitor where the browser window is located
|
||||||
w = EM_ASM_INT( { return screen.width; }, 0);
|
int width = 0;
|
||||||
return w;
|
width = EM_ASM_INT( { return screen.width; }, 0);
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor height (currently used by monitor)
|
// Get selected monitor height (currently used by monitor)
|
||||||
int GetMonitorHeight(int monitor)
|
int GetMonitorHeight(int monitor)
|
||||||
{
|
{
|
||||||
int h = 0;
|
// NOTE: Returned value is limited to the current monitor where the browser window is located
|
||||||
h = EM_ASM_INT( { return screen.height; }, 0);
|
int height = 0;
|
||||||
return h;
|
height = EM_ASM_INT( { return screen.height; }, 0);
|
||||||
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor physical width in millimetres
|
// Get selected monitor physical width in millimetres
|
||||||
@@ -616,8 +618,11 @@ const char *GetMonitorName(int monitor)
|
|||||||
// Get window position XY on monitor
|
// Get window position XY on monitor
|
||||||
Vector2 GetWindowPosition(void)
|
Vector2 GetWindowPosition(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GetWindowPosition() not implemented on target platform");
|
// NOTE: Returned position is relative to the current monitor where the browser window is located
|
||||||
return (Vector2){ 0, 0 };
|
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
|
// Get window scale DPI factor for current monitor
|
||||||
|
Reference in New Issue
Block a user