diff --git a/Source/ui_ios/Base.lproj/Main.storyboard b/Source/ui_ios/Base.lproj/Main.storyboard index 567e0ea9..f4f630a9 100644 --- a/Source/ui_ios/Base.lproj/Main.storyboard +++ b/Source/ui_ios/Base.lproj/Main.storyboard @@ -250,10 +250,10 @@ - + - + diff --git a/Source/ui_ios/EmulatorViewController.mm b/Source/ui_ios/EmulatorViewController.mm index 60a411fa..6aa71687 100644 --- a/Source/ui_ios/EmulatorViewController.mm +++ b/Source/ui_ios/EmulatorViewController.mm @@ -27,11 +27,6 @@ CPS2VM* g_virtualMachine = nullptr; -(void)viewDidLoad { - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - - auto view = [[GlEsView alloc] initWithFrame: screenBounds]; - self.view = view; - self.connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) { if ([[GCController controllers] count] == 1) { [self toggleHardwareController:YES]; diff --git a/Source/ui_ios/GlEsView.mm b/Source/ui_ios/GlEsView.mm index 1a3f23e9..f011cc58 100644 --- a/Source/ui_ios/GlEsView.mm +++ b/Source/ui_ios/GlEsView.mm @@ -8,37 +8,52 @@ return [CAEAGLLayer class]; } +-(void)initView +{ + hasRetinaDisplay = NO; + if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")]) + { + if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")]) + { + float scale = [[UIScreen mainScreen] scale]; + self.contentScaleFactor = scale; + if(scale == 2.0f) + { + hasRetinaDisplay = YES; + } + } + } + + CAEAGLLayer* eaglLayer = (CAEAGLLayer*)self.layer; + + eaglLayer.opaque = TRUE; + eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithBool: FALSE], kEAGLDrawablePropertyRetainedBacking, + kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, + nil]; +} + -(id)initWithFrame: (CGRect)frame { self = [super initWithFrame: frame]; if(self) { - hasRetinaDisplay = NO; - if([[UIScreen mainScreen] respondsToSelector: NSSelectorFromString(@"scale")]) - { - if([self respondsToSelector: NSSelectorFromString(@"contentScaleFactor")]) - { - float scale = [[UIScreen mainScreen] scale]; - self.contentScaleFactor = scale; - if(scale == 2.0f) - { - hasRetinaDisplay = YES; - } - } - } - - CAEAGLLayer* eaglLayer = (CAEAGLLayer*)self.layer; - - eaglLayer.opaque = TRUE; - eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool: FALSE], kEAGLDrawablePropertyRetainedBacking, - kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, - nil]; + [self initView]; } return self; } +-(id)initWithCoder: (NSCoder*)decoder +{ + self = [super initWithCoder: decoder]; + if(self) + { + [self initView]; + } + return self; +} + -(BOOL)hasRetinaDisplay { return hasRetinaDisplay;