Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] [iOS] Option to use storyboards for launch screens. #40173

Merged
merged 2 commits into from
Jul 9, 2020

Conversation

naithar
Copy link
Contributor

@naithar naithar commented Jul 7, 2020

This PR gives developer an option to use .storyboard file instead of simple images for iOS application's launch screen.
Default value for this setting is false so it wouldn't break existing projects export.
By default storyboard uses the same values (background, image, scaling) used for Godot's logo screen. But user can specify specific parameters if required.

Should fix #39325 as well as future warnings or errors regarding incorrect launch image sizes.
Also removes current warnings about LaunchImage deprecation.

Tested on multiple devices (iPad, and multiple iPhones).
Without using custom settings for launch screen the result looks the same as Godot's logo in Main::setup2() method call.
One thing to note: to correctly test this change, it might be required to delete resulting app and restart iOS device after reexporting godot project, since iOS seems to be caching launch screen images and storyboards.

Currently fully testable only on 3.2, but master's version of this commit is also ready for PR and it builds on osx and displays new export options.

r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "storyboard/use_launch_screen_storyboard"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "storyboard/image_scale_mode", PROPERTY_HINT_ENUM, "Same as Logo,Center,Scale To Fit,Scale To Fill,Scale"), 0));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@2x", PROPERTY_HINT_FILE, "*.png"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@3x", PROPERTY_HINT_FILE, "*.png"), ""));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default splash.png for the 2x and 3x size have the same 800x600 size, probably it's better to make them actually be 2x and 3x sized.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using same size for default splash.png is intentional. When I tried to use correctly sized default images - splash screen would differ from Godot’s logo on devices using @3x, like iPhone XS. I guess it have something to do with the way logo is displayed when it’s not scaling - it uses exact image size without modifying it in any way

@akien-mga
Copy link
Member

Thanks!

@naithar naithar deleted the feature/ios-storyboard-usage branch July 9, 2020 08:19
@oeleo1
Copy link

oeleo1 commented Jul 14, 2020

This is great! Thanks a lot. I tried it and the storyboard option works well. However, after the storyboard shows up, it disappears and I get a black screen for several seconds (custom color is black in the project settings) until the game is loaded and starts. I guess the problem is of the same nature as the one described for Android in #21824 and the example project attached there exhibits the problem. Maybe you can have a look. Thanks again for the support of storyboards!

@naithar
Copy link
Contributor Author

naithar commented Jul 14, 2020

@oeleo1 well, iOS loading screen is displayed only while application loads dylibs into memory and performs finishLoading method. Then it's up to the application to handle what will be displayed.
The reason for logo not being displayed immediately and showing black screen is that it's displayed only on setup2() call, while setup() and everything else happening between setup2() call and finishLoading can take a lot of time to finish.
But changing this behavior atm would probably require a proposal getting evaluated - godotengine/godot-proposals#1175.

@oeleo1
Copy link

oeleo1 commented Jul 14, 2020

Thanks for your input. The referred proposal suggests removing the boot splash which is not what we need. We do need boot splash, it is absolutely essential for big games (200+MB) which take many seconds to load, No one would launch a game and appreciate a black screen for 10 seconds. So the question is whether we can let the storyboard (as a derivative of the boot splash) last until finishLoading so that the game can take over immediately. That black emptiness in the middle is nonsense :-) I'd be happy to continue discussing that there, but the topic and purpose of the proposal sounds different. Thanks.

@andy-noisyduck
Copy link
Contributor

andy-noisyduck commented Jul 14, 2020

The intent of the proposal was to avoid the "double splash" of having a Launcher image followed by another Godot splash for projects that don't need a second splash. Whether you require a single splash or not, in both cases we want to keep the Launch Image until something is ready to take over so that we don't get the period of blackness in the middle. Perhaps that should be fleshed out as its own proposal - they are related but not quite the same.

If your app is massive, you probably want to keep the launch image there long enough to load an initial splash scene, and use background loading (e.g. via ResourceInteractiveLoader) to give loading progress whilst the rest of your game starts up.

Edit: Also thanks for this! Was looking for storyboard support. I'm pretty sure Apple will make it mandatory at some point in the near future anyway (currently is just "recommended").

@oeleo1
Copy link

oeleo1 commented Jul 14, 2020

You've done an amazing job on this -- I can't tell you how happy I am to see this commit.

Now, I hear you on the background loading, but that's like taking a U-turn on the standard straightforward loading sequence. What we really need is an image while the game loads "as is". And we just can't get it. Please try the attached simplistic project (2 nodes) on iOS which really shows what our problem is. I'll take any solution. Thanks!
Boot_Splash.zip

@naithar
Copy link
Contributor Author

naithar commented Jul 14, 2020

As I said this changes that you want would probably require changes in how iOS platform performs Godot's loading sequence. This would probably need a proposal or an issue :)

@oeleo1
Copy link

oeleo1 commented Jul 15, 2020

The issue is #38897 which has been closed and redirected to #21824 which is open since 2.5 years.

Not sure what else we need here, except to understand why the boot image doesn't show on the screen on iOS when Godot writes to the system FBO in setup2() before loading the project. It shows only after the project is loaded and the user project is started. This is what causes the black emptiness in the middle and it is probably related to app styling, decorelated to the way Godot writes to the FBO just like on Android, But I am not sure about the latter.

I'd be happy with a solution which lets the storyboard last until the user project starts,which is just what the boot splash logo is for and which currently doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants