Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.49k stars 170 forks source link

Android screen rotation #1265

Open Sanva opened 3 years ago

Sanva commented 3 years ago

Describe the solution you'd like An Android implementation for kha.System.screenRotation — and a notification about the screen change would be even more awesome.

Describe alternatives you've considered Constantly polling window dimensions — it is something that can work in simple cases... but not for everything.

In fact, in my specific case (resizing and repositioning screen elements, like a gamepad) it would suffice if Window.notifyOnResize would be fired because of the screen dimensions changing... but it is not the case.

Sanva commented 3 years ago

[...] it would suffice if Window.notifyOnResize would be fired because of the screen dimensions changing... but it is not the case.

That actually looks like a bug in Android 8, or something — I've found references about the underlying Android method (ANativeActivityCallbacks.onNativeWindowResized) firing when screen rotation changes, so I've tested it with another phone: