fix orientation-change can not work normally (#16774)

* fix orientation-change can not work normally
This commit is contained in:
bofeng-song
2024-03-22 09:27:54 +08:00
committed by GitHub
parent 559bfc9467
commit 5da2f9b63a
9 changed files with 167 additions and 30 deletions
@@ -36,12 +36,16 @@ JNIEXPORT void JNICALL Java_com_cocos_lib_CocosOrientationHelper_nativeOnOrienta
switch (rotation) {
case 0: // ROTATION_0
orientation = (int)cc::Device::Orientation::PORTRAIT;
break;
case 1: // ROTATION_90
orientation = (int)cc::Device::Orientation::LANDSCAPE_RIGHT;
break;
case 2: // ROTATION_180
orientation = (int)cc::Device::Orientation::PORTRAIT_UPSIDE_DOWN;
break;
case 3: // ROTATION_270
orientation = (int)cc::Device::Orientation::LANDSCAPE_LEFT;
break;
}
// run callbacks in game thread?
cc::events::Orientation::broadcast(orientation);