-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add function to get mobile device's notch position and size on iOS (already implemented on Android) #3466
Comments
I don't know of any such device. As of 2021, the 3 most popular options are a notch, a hole (cornered or centered), or an under-display camera with no notch or hole in sight. |
For reference, this was implemented in 4.0 by godotengine/godot#60551, and in 3.5 by godotengine/godot#60552. |
godotengine/godot#60551 and godotengine/godot#60552 only implement this feature on Android. It still needs to be implemented on iPhone. |
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 usinggetCutoutPath()
.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.
The text was updated successfully, but these errors were encountered: