Incorrect content drawing on Android for landscape-mode

Incorrect content drawing on Android for landscape-mode, but only sometimes and it’s very difficult to reproduce this issue.
So sometimes when the user returns to the application I start to show content like for portrait mode (but app designed only for landscape).

There is a sample:
https://monosnap.com/file/V6PgvvpwSWuBAMVZton5mXfYJAiU3H

Also application stop response for any click-events.

And there is only one way I found how can I reproduce this issue:

  1. Create empty cpp-project for cocos2d-x 3.16

  2. At the method bool AppDelegate::applicationDidFinishLaunching() paste next line before return true;

cocos2d::log("FrameSize is [%f] [%f]", glview->getFrameSize().width, glview->getFrameSize().height );

If build application normally and start it - in the log I see:

FrameSize is [2009.000000] [1080.000000]

(this is correct)

  1. Lock phone and build+launch application while phone locked (I used Android Studio 2)

After app launched I see next message in the log:

FrameSize is [1080.000000] [2009.000000]

And result showed on the screen before.
Also application stop response for any click-events.

PS: I found how to reproduce issue only today, but had this problem more than 1 year before (for example when I used cocos2d-x 3.11)

PS2: I used Samsung Galaxy S8, but also had some problem on Samsung Galaxy S7, S3

May be this will help you.

1 Like

That’s great !!!
Thank you 3x-times! :slight_smile:

Why this officially not supported by cocos2d-x framework?

Just add PORTRAIT / LANDSCAPE param/property anywhere on app-start/activity/etc or read this from manifest. I got this problem too long… And maybe a lot of developers even don’t know about this issue…

I dont know, maybe because its Android only issue?
Also engine should handle such scenario from cpp side, then such issue will not arise.
(Actually my solution is hack basically, but it works fine :slight_smile: )