mirror of
https://github.com/yawut/SDL.git
synced 2026-07-01 00:39:58 -05:00
Only change the UI orientation if it's actually necessary for the mode.
This commit is contained in:
parent
9ca4ed791b
commit
8f2b68788d
|
|
@ -357,11 +357,12 @@ UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
|
|||
SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata;
|
||||
[data->uiscreen setCurrentMode:modedata->uiscreenmode];
|
||||
|
||||
CGSize size = [modedata->uiscreenmode size];
|
||||
if (size.width >= size.height) {
|
||||
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
|
||||
} else {
|
||||
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
|
||||
if (mode->w > mode->h) {
|
||||
if (!UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
|
||||
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
|
||||
} else if (mode->w < mode->h) {
|
||||
if (!UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]))
|
||||
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user