mirror of
https://github.com/raysan5/raylib.git
synced 2026-09-14 01:50:50 +00:00
[rcore][GLFW] Fix window centering overflow with unsigned screen size (#6119)
CORE.Window.screen/render sizes are unsigned, so the subtraction against the monitor workarea wraps when the window is larger than the monitor, producing a huge positive position instead of a negative one.
This commit is contained in:
@@ -1804,11 +1804,11 @@ int InitPlatform(void)
|
||||
|
||||
// Center window into current monitor
|
||||
#if defined(__APPLE__)
|
||||
CORE.Window.position.x = monitorX + (monitorWidth - CORE.Window.screen.width)/2;
|
||||
CORE.Window.position.y = monitorY + (monitorHeight - CORE.Window.screen.height)/2;
|
||||
CORE.Window.position.x = monitorX + (monitorWidth - (int)CORE.Window.screen.width)/2;
|
||||
CORE.Window.position.y = monitorY + (monitorHeight - (int)CORE.Window.screen.height)/2;
|
||||
#else
|
||||
CORE.Window.position.x = monitorX + (monitorWidth - CORE.Window.render.width)/2;
|
||||
CORE.Window.position.y = monitorY + (monitorHeight - CORE.Window.render.height)/2;
|
||||
CORE.Window.position.x = monitorX + (monitorWidth - (int)CORE.Window.render.width)/2;
|
||||
CORE.Window.position.y = monitorY + (monitorHeight - (int)CORE.Window.render.height)/2;
|
||||
#endif
|
||||
SetWindowPosition(CORE.Window.position.x, CORE.Window.position.y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user