diff options
Diffstat (limited to 'editor/project_manager.cpp')
-rw-r--r-- | editor/project_manager.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index d011d7a7e7..cd95f97286 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2872,10 +2872,17 @@ ProjectManager::ProjectManager() { if (scale_factor > 1.0) { Vector2i window_size = DisplayServer::get_singleton()->window_get_size(); Vector2i screen_size = DisplayServer::get_singleton()->screen_get_size(); - window_size *= scale_factor; + Vector2i screen_position = DisplayServer::get_singleton()->screen_get_position(); + + // Consider the editor display scale. + window_size.x = round((float)window_size.x * scale_factor); + window_size.y = round((float)window_size.y * scale_factor); + + // Make the window centered on the screen. Vector2i window_position; - window_position.x = (screen_size.x - window_size.x) / 2; - window_position.y = (screen_size.y - window_size.y) / 2; + window_position.x = screen_position.x + (screen_size.x - window_size.x) / 2; + window_position.y = screen_position.y + (screen_size.y - window_size.y) / 2; + DisplayServer::get_singleton()->window_set_size(window_size); DisplayServer::get_singleton()->window_set_position(window_position); } |