Hey, I’m trying to handle switching resolutions from Settings on Android while the game is running and after some experimenting I haven’t found out how to do that.
So you can see what I’m trying to do, I built the CppEmptyTest from the Cocos repo. When I run the game, it looks as expected (the black stripe on the left is just because of the screen cutout, don’t worry about that):
Then, while the game is running, I go to settings and change the screen resolution from 1520x720 to 3040x1440:
When I go back to the game, the result is this:
If I kill the app and start it again, it works fine, so it’s not a problem of handling multiple screen sizes, that works as expected. But how can I handle the resolution changing while the game is running?
There are some callbacks where I can detect the change but I don’t know how to handle it. Probably the GL surface needs to be recreated or at least the scale factor needs to be updated, but I’m not sure how to do that and several things I’ve tried either end up crashing the app or have no impact at all.
Is anyone handling this properly in their games? Any help is appreciated. Thanks!