Add function to get mobile device's notch position and size on iOS (already implemented on Android) #3466
Description
Describe the project you are working on
A non-game project that has a lot of GUI elements, but this could also apply to games for mobile devices.
Describe the problem or limitation you are having in your project
Since godotengine/godot#43104, it is possible to get the safe area of the screen (on Android, not sure about iOS). This helps avoid putting UI elements on parts of the screen that are hidden. However, this also means that part of the screen is not usable, while some apps or games could use the space to display UI elements (a less obtrusive menu button, for instance).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Android (again, not sure about iOS) exposes functions to get the inactive areas' position and dimensions, which could be used to work the UI around those inactive areas, instead of removing the entire upper part of the screen.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
godotengine/godot#43104 already calls getDisplayCutout()
to determine the safe area, this could also be used to return an array of Rect2 corresponding to all inactive areas. As a bonus, we could even get the notch's actual shape using getCutoutPath()
.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I think the only way to work around this would be to write an Android plugin (I have no experience with those, but I assume it's doable).
Is there a reason why this should be core and not an add-on in the asset library?
Unless sensors behind the screen become the next standard, notches and punch holes are going to be visible on many phones to come, so having a built-in way to work around them (or with them) could be helpful.
Metadata
Assignees
Type
Projects
Status
Ready for Implementation