axmolengine / axmol

Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A fork of Cocos2d-x-4.0)
https://axmol.dev
MIT License
681 stars 175 forks source link

Android: bug in getSafeAreaRect calculations #1876

Open crazyhappygame opened 2 weeks ago

crazyhappygame commented 2 weeks ago
  1. Draw auto safeAreaRect = _director->getSafeAreaRect();
  2. Bug: safeAreaRect does not take into account corners at the bottom of screen.

Please check screenshots below. Blue rectangle it is safeAreaRect. For Android devices with rounded corners blue is not drawn properly.

Android incorrect: moto G54 (the same issue on other Android devices with rounded corners) WhatsApp Image 2024-05-02 at 22 02 29

IPhone correct: iPhone Max Pro 15 WhatsApp Image 2024-05-02 at 21 58 32

rh101 commented 2 weeks ago

Have you checked the Rect GLViewImpl::getSafeAreaRect() method in GLViewImpl-android.cpp when running on a device with rounded corners to see what is going on in there? Check if this line is returning true: bool isScreenRound = JniHelper::callStaticBooleanMethod("org/axmol/lib/AxmolEngine", "isScreenRound");