diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-04-11 10:40:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-11 10:40:58 +0200 |
commit | d87307d850186d27d2c27c5916ec8c4744c14979 (patch) | |
tree | ac92fff83829becd823aea985c923740d73119e6 /platform/iphone/gl_view.mm | |
parent | 4d787869e189b670d609f33c308991741592e40a (diff) | |
parent | 1d9a3a9b1c9ef7db26e53c8aeaab731992cffd6e (diff) |
Merge pull request #18106 from endragor/iphone-x
iPhone X support and iOS-related fixes
Diffstat (limited to 'platform/iphone/gl_view.mm')
-rw-r--r-- | platform/iphone/gl_view.mm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 69116c64c6..ff95cf6e5f 100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -78,6 +78,16 @@ void _hide_keyboard() { keyboard_text = ""; }; +Rect2 _get_ios_window_safe_area(float p_window_width, float p_window_height) { + UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, 0, 0); + if (_instance != nil && [_instance respondsToSelector:@selector(safeAreaInsets)]) { + insets = [_instance safeAreaInsets]; + } + ERR_FAIL_COND_V(insets.left < 0 || insets.top < 0 || insets.right < 0 || insets.bottom < 0, + Rect2(0, 0, p_window_width, p_window_height)); + return Rect2(insets.left, insets.top, p_window_width - insets.right - insets.left, p_window_height - insets.bottom - insets.top); +} + bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { p_path = ProjectSettings::get_singleton()->globalize_path(p_path); @@ -326,9 +336,7 @@ static void clear_touches() { // Generate IDs for a framebuffer object and a color renderbuffer UIScreen *mainscr = [UIScreen mainScreen]; printf("******** screen size %i, %i\n", (int)mainscr.currentMode.size.width, (int)mainscr.currentMode.size.height); - float minPointSize = MIN(mainscr.bounds.size.width, mainscr.bounds.size.height); - float minScreenSize = MIN(mainscr.currentMode.size.width, mainscr.currentMode.size.height); - self.contentScaleFactor = minScreenSize / minPointSize; + self.contentScaleFactor = mainscr.nativeScale; glGenFramebuffersOES(1, &viewFramebuffer); glGenRenderbuffersOES(1, &viewRenderbuffer); @@ -627,6 +635,7 @@ static void clear_touches() { } init_touches(); self.multipleTouchEnabled = YES; + self.autocorrectionType = UITextAutocorrectionTypeNo; printf("******** adding observer for sound routing changes\n"); [[NSNotificationCenter defaultCenter] |