1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add Stretch Modes for Splash Screen

Co-authored-by: Samuel Pedrajas <samuelpedrajaspz@gmail.com>
This commit is contained in:
Justin Sasso
2025-08-13 20:59:57 -04:00
parent c7b1767560
commit b6b3e1ef9e
16 changed files with 178 additions and 46 deletions

View File

@@ -98,9 +98,32 @@ HashMap<String, Variant> EditorExportPlatformIOS::get_custom_project_settings(co
switch (image_scale_mode) {
case 0: {
String logo_path = get_project_setting(p_preset, "application/boot_splash/image");
bool is_on = get_project_setting(p_preset, "application/boot_splash/fullsize");
RenderingServer::SplashStretchMode stretch_mode = get_project_setting(p_preset, "application/boot_splash/stretch_mode");
// If custom logo is not specified, Godot does not scale default one, so we should do the same.
value = (is_on && logo_path.length() > 0) ? "scaleAspectFit" : "center";
if (logo_path.is_empty()) {
value = "center";
} else {
switch (stretch_mode) {
case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_DISABLED: {
value = "center";
} break;
case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_KEEP: {
value = "scaleAspectFit";
} break;
case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_KEEP_WIDTH: {
value = "scaleAspectFit";
} break;
case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_KEEP_HEIGHT: {
value = "scaleAspectFit";
} break;
case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_COVER: {
value = "scaleAspectFill";
} break;
case RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_IGNORE: {
value = "scaleToFill";
} break;
}
}
} break;
default: {
value = storyboard_image_scale_mode[image_scale_mode - 1];

View File

@@ -174,7 +174,8 @@ void EditorExportPlatformWeb::_fix_html(Vector<uint8_t> &p_html, const Ref<Edito
Vector<String> godot_splash_classes;
godot_splash_classes.push_back("show-image--" + String(get_project_setting(p_preset, "application/boot_splash/show_image")));
godot_splash_classes.push_back("fullsize--" + String(get_project_setting(p_preset, "application/boot_splash/fullsize")));
RenderingServer::SplashStretchMode boot_splash_stretch_mode = get_project_setting(p_preset, "application/boot_splash/stretch_mode");
godot_splash_classes.push_back("fullsize--" + String(((boot_splash_stretch_mode != RenderingServer::SplashStretchMode::SPLASH_STRETCH_MODE_DISABLED) ? "true" : "false")));
godot_splash_classes.push_back("use-filter--" + String(get_project_setting(p_preset, "application/boot_splash/use_filter")));
replaces["$GODOT_SPLASH_CLASSES"] = String(" ").join(godot_splash_classes);
replaces["$GODOT_SPLASH"] = p_name + ".png";