diff options
author | Alex Szpakowski <slime73@gmail.com> | 2014-11-20 17:19:26 -0400 |
---|---|---|
committer | Alex Szpakowski <slime73@gmail.com> | 2014-11-20 17:19:26 -0400 |
commit | e2ae0eefb1e80114ed2954e9a2e1502a74d51939 (patch) | |
tree | 41937e30d921b11ba8e01a34e3a2eda82f2f4ced /src/video/uikit/SDL_uikitviewcontroller.m | |
parent | 659324701af3256995d57fd1b399af21cd5b41d8 (diff) | |
download | sdl-e2ae0eefb1e80114ed2954e9a2e1502a74d51939.tar.gz |
Fixed mismatching orientations for the window width and height on iOS when the window is created or the app is brought to the foreground, when SDL_HINT_ORIENTATIONS or SDL_WINDOW_FULLSCREEN is used.
Diffstat (limited to 'src/video/uikit/SDL_uikitviewcontroller.m')
-rw-r--r-- | src/video/uikit/SDL_uikitviewcontroller.m | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index 0a9fbab4a..de5b3008c 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -62,44 +62,7 @@ - (NSUInteger)supportedInterfaceOrientations { - NSUInteger orientationMask = 0; - const char *hint = SDL_GetHint(SDL_HINT_ORIENTATIONS); - - if (hint != NULL) { - NSArray *orientations = [@(hint) componentsSeparatedByString:@" "]; - - if ([orientations containsObject:@"LandscapeLeft"]) { - orientationMask |= UIInterfaceOrientationMaskLandscapeLeft; - } - if ([orientations containsObject:@"LandscapeRight"]) { - orientationMask |= UIInterfaceOrientationMaskLandscapeRight; - } - if ([orientations containsObject:@"Portrait"]) { - orientationMask |= UIInterfaceOrientationMaskPortrait; - } - if ([orientations containsObject:@"PortraitUpsideDown"]) { - orientationMask |= UIInterfaceOrientationMaskPortraitUpsideDown; - } - } - - if (orientationMask == 0 && (window->flags & SDL_WINDOW_RESIZABLE)) { - orientationMask = UIInterfaceOrientationMaskAll; /* any orientation is okay. */ - } - - if (orientationMask == 0) { - if (window->w >= window->h) { - orientationMask |= UIInterfaceOrientationMaskLandscape; - } - if (window->h >= window->w) { - orientationMask |= (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); - } - } - - /* Don't allow upside-down orientation on the phone, so answering calls is in the natural orientation */ - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { - orientationMask &= ~UIInterfaceOrientationMaskPortraitUpsideDown; - } - return orientationMask; + return UIKit_GetSupportedOrientations(window); } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient @@ -119,7 +82,7 @@ - (UIStatusBarStyle)preferredStatusBarStyle { - /* We assume most games don't have a bright white background. */ + /* We assume most SDL apps don't have a bright white background. */ return UIStatusBarStyleLightContent; } |