-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
[iOS] Sync the boot splash and the launch screen image scale modes #102668
[iOS] Sync the boot splash and the launch screen image scale modes #102668
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be working as expected.
79976cb
to
7ba2049
Compare
Please try to avoid pushing so many times in a row (10 times in 35 minutes), it really puts pressure on the automatic checks |
Apologies, I didn't realize. Will avoid that. |
The additions to Vector2 and OS seem highly specific and not really warranted to be core additions. Please add such code as helper methods where it's needed and not in core - see https://docs.godotengine.org/en/stable/contributing/development/best_practices_for_engine_contributors.html#prefer-local-solutions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see (a priori) a reason to add a new API to Vector2 to calculate some boot splash metrics.
In second review, I see the OS one is used in RendererRD so I guess that's needed, though that still feels a bit weird architecture wise.
Thanks for the prompt feedback everyone.
I'll move the methods. But just to share my thought process - I chose adding them to the core, because the functionality itself (fitting a size inside another size given a stretch mode) is not specific to iOS. In fact, this code already exists (it is essentially what So my rationale was that by putting this in core, it could help unify this type of aspect fitting logic in the future. However, I see how my approach does not fully align with existing conventions, so I'm happy to move it.
An obvious other solution could be to have an OS-specific branch in the RendererRD, but I think it is also not ideal (there is no precedent to branch like that in this class). However, as it's a small change specific to just one platform, maybe that's preferable, instead of complicating the OS API. Please let me know if you prefer me to change the singleton approach as well. Next steps:
|
Sounds good to me!
That's a good point. Our current guidelines would likely be to hardcode it again in iOS for now, but look later if we want to refactor and harmonize this code with a core API. We often do that to first confirm that there's a frequent need for a bit of API before solidifying it in the core. |
7ba2049
to
0e266b0
Compare
Pushed an update that moves the 2 methods to iOS. I also removed the tests I had added to Vector2 (they were useful to validate everything while it was WIP, but not sure they would add a lot of value in the iOS singleton). I already squashed it, but in retrospect I realize that makes it harder to see what I changed. I'll wait for the review to be finalized next time before squashing, sorry about the inconvenience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Thanks! |
What does this PR address?
Using iOS launch screens for the boot splash is not aligned with how Godot renders the boot splash.
On iOS the splash screen with launch images happens in two stages:
This is partially addressing #81389 (though this PR does not address any compatibility issues with the legacy renderer)
Change outline
Vector2
for fitting Vector2 inside another Vector2, either with aspect-fit-center or aspect-fit-cover modes (analogous to what the TextureRect exposes)RendererCompositorRD
to allow theOS
singleton to calculate the splash area. The iOS singleton will fetch the aspect mode fromInfo.plist
and calculate a matching area. Others will keep existing behavior.Testing
Here's some visual examples of the effect.
Landscape - export template specifies "scale to fill"
Before the changes:
bad__landscape__keepAspectCovered__scaleToFill.mov
After the changes:
good__landscape__keepAspectCovered__scaleToFill.mov
Portrait - export template specifies "scale"
Before the changes:
bad__portrait__scale__scale.mov
After the changes:
good_portrait__scale__scale.mp4