[SOLVED] How to check if a node is blocked by a rounded screen corner?

Hi!
I want to display debug info in the top left screen corner but on Android it’s partially blocked by a rounded screen corner. How do i check if the node is blocked by a rounded corner so i can move it little lower?

2 Likes

The rounded screen corner depends on what your device model is. So you can check it by using sys.get_sys_info().device_model

I also found this Insets: Apply rounded corners | Views | Android Developers
It requires you to write a native extension to use it. You can reference https://github.com/defold/extension-safearea

5 Likes

Thank you, i’ll consider this option

It doesn’t work on my phone (Android)

Which phone and how do you implement it?

My phone: Redmi Note 10S (Android 13; MIUI Global 14.0.3)
I added this native extension into my project (as stated in the instructions) but black background outside the save area doesn’t appear

New function to extension-safearea added: safearea.get_corners_radius()

Take a look example, maybe it will help: https://github.com/defold/extension-safearea/blob/master/main/main.script

4 Likes

You must adjust gui nodes yourself, the extension just provides functions to get paddings, it doesn’t adjust game window or your stuff

Now when i build my project i get error:

/safearea/src/safearea_null.cpp
	Line 15: unknown type name 'SafeAreaStatus'; did you mean 'safeareans::SafeAreaStatus'?
   15 | SafeAreaStatus safeareans::GetCornersRadius(Corners* corners){
      | ^~~~~~~~~~~~~~
      | safeareans::SafeAreaStatus

But when i use v1.4.0, everything is fine

Fixed in Release Fix build on non-mobile platforms · defold/extension-safearea · GitHub

It works

Does corner radius of 106 mean corner is 106x106 pixels?

Please, read the official android manual to figure out what that means Insets: Apply rounded corners  |  Views  |  Android Developers

1 Like

Yeah, now it works and the debug info isn’t blocked by the rounded corner
Thank you very much
PS: while solving some mini-problem with the debug info pos i found the key to solving a very important problem (with nodes pos) whick i’ve been solving for a whole week :grinning_face_with_smiling_eyes:

2 Likes

I’ve found a bug:
The extension returns 0 when i call its functions in first frames

It’s not a bug. Please read example and documentation. It’s explained there.

I got it