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

Android ability to display game along the notch. #1622

Closed
rmichaluszek opened this issue Oct 6, 2020 · 9 comments
Closed

Android ability to display game along the notch. #1622

rmichaluszek opened this issue Oct 6, 2020 · 9 comments

Comments

@rmichaluszek
Copy link

rmichaluszek commented Oct 6, 2020

Describe the project you are working on:

Im working on a mobile game

Describe the problem or limitation you are having in your project:

that would like to be shown in real full screen, but the sides along the notch are just black, I would like to show my game in these places too.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

Some property in the project settings under the android, for example support notch true/false or something like that would be really useful, because there are a lot of phones now that have notches.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

It would just (probably) modify the manifest file, but i dont know how actually because i tried to do this manually and none of manifest properties worked for me to show the game along the notches.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

Is there a reason why this should be core and not an add-on in the asset library?:

I encountered a lot of posts on different portals about this, and there are no answears or fixes for this problem yet.
eg: link

@facciocose
Copy link

I think the post linked has an updated answer that solves this issue.

Using custom build system you can override the default android theme and add android:windowLayoutInDisplayCutoutMode.

@kyoz
Copy link

kyoz commented Apr 21, 2021

Confirm, the guide in the post work for me. Tried on a few phones

@Calinou
Copy link
Member

Calinou commented Apr 25, 2021

Is this implemented in 3.3 now when immersive mode is enabled? Judging by this Q&A question, the game now seems to display behind the notch by default.

@kyoz
Copy link

kyoz commented Apr 27, 2021

@Calinou I'v just tried Godot 3.3. Yes, it is implemented, i no longer need custom android build.

@Calinou Calinou closed this as completed Apr 27, 2021
@Calinou Calinou added this to the 3.x milestone Apr 27, 2021
@GForceProductions
Copy link

What if I don't want to display behind the notch? Both Android and iOS.
I am using stretch mode viewport and ignore aspect ratio, and want to stretch it to the screen size without the notch and bars on its sides.
Because now it will stretch to the entire screen including notch, and part of the app falls behind the notch and is not visible, which is rather annoying

@Calinou
Copy link
Member

Calinou commented Aug 14, 2021

@GForceProductions You can use OS.get_window_safe_area() which returns the area of the screen not hidden by the notch. Use the return value to move UI elements so they don't appear behind the notch.

Alternatively, add some margin on all sides to prevent UI elements from being placed behind the notch (or otherwise being too close to it).

@GForceProductions
Copy link

@Calinou Thank you for the reply and suggestion.
I am wondering if it is also possible to let the engine disregard that area completely?
Because reading the issue it sounds like that is how it used to be?

@Calinou
Copy link
Member

Calinou commented Aug 14, 2021

@Calinou Thank you for the reply and suggestion.
I am wondering if it is also possible to let the engine disregard that area completely?
Because reading the issue it sounds like that is how it used to be?

There doesn't appear to be a built-in way to do this anymore (on iOS at least). See also godotengine/godot#49887.

As a workaround, you could display an opaque black ColorRect node above the notch area (determined by what's outside the safe area). Either way, I think modern mobile games are really expected to use the notch area in a clever way. For example, you could use this small area to let the player see more of the game world. Considering mobile displays are small enough already, every square centimeter of display helps here. Just make sure the UI doesn't touch the notch 🙂

@GForceProductions
Copy link

Ok thank you!

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

No branches or pull requests

5 participants