You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
[iOS] Sync the boot splash and the launch screen image scale modes
This commit is contained in:
@@ -222,6 +222,23 @@ uint64_t OS::get_embedded_pck_offset() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Default boot screen rect scale mode is "Keep Aspect Centered"
|
||||
Rect2 OS::calculate_boot_screen_rect(const Size2 &p_window_size, const Size2 &p_imgrect_size) const {
|
||||
Rect2 screenrect;
|
||||
if (p_window_size.width > p_window_size.height) {
|
||||
// Scale horizontally.
|
||||
screenrect.size.y = p_window_size.height;
|
||||
screenrect.size.x = p_imgrect_size.x * p_window_size.height / p_imgrect_size.y;
|
||||
screenrect.position.x = (p_window_size.width - screenrect.size.x) / 2;
|
||||
} else {
|
||||
// Scale vertically.
|
||||
screenrect.size.x = p_window_size.width;
|
||||
screenrect.size.y = p_imgrect_size.y * p_window_size.width / p_imgrect_size.x;
|
||||
screenrect.position.y = (p_window_size.height - screenrect.size.y) / 2;
|
||||
}
|
||||
return screenrect;
|
||||
}
|
||||
|
||||
// Helper function to ensure that a dir name/path will be valid on the OS
|
||||
String OS::get_safe_dir_name(const String &p_dir_name, bool p_allow_paths) const {
|
||||
String safe_dir_name = p_dir_name;
|
||||
|
||||
Reference in New Issue
Block a user