mirror of
https://github.com/libretro/Play-.git
synced 2024-11-30 12:10:42 +00:00
Instantiate GlEs view through storyboard.
This commit is contained in:
parent
766f48878d
commit
b1889d1ebd
@ -250,10 +250,10 @@
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="GlEsView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user