diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-09-03 08:26:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 08:26:17 +0200 |
commit | 6ead00733aea5eb0003e70ffbf71997b9be2c8c4 (patch) | |
tree | c172bcf73cb5d3c2922b427fcf0f5b40e1fe2d42 | |
parent | 19d57894d85b53218f1e4aa3cd5867ef4c5a0289 (diff) | |
parent | 4ccf25a577feef3201ab2ca13905cd56990dc683 (diff) |
Merge pull request #21714 from avencherus/multi-screen-center
Added multi-monitor support for center_window()
-rw-r--r-- | core/os/os.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp index e90d714450..0e6251a4fb 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -632,10 +632,13 @@ void OS::center_window() { if (is_window_fullscreen()) return; + Point2 sp = get_screen_position(get_current_screen()); Size2 scr = get_screen_size(get_current_screen()); Size2 wnd = get_real_window_size(); - int x = scr.width / 2 - wnd.width / 2; - int y = scr.height / 2 - wnd.height / 2; + + int x = sp.width + (scr.width - wnd.width) / 2; + int y = sp.height + (scr.height - wnd.height) / 2; + set_window_position(Vector2(x, y)); } |