Explorar o código

Merge pull request #71 from bslack/next

Added support for etina displays
Sean Paul Taylor %!s(int64=13) %!d(string=hai) anos
pai
achega
cce02a12bf
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      gameplay/src/PlatformiOS.mm

+ 5 - 1
gameplay/src/PlatformiOS.mm

@@ -103,11 +103,15 @@ int getKey(unichar keyCode);
         }
         }
         
         
         // Configure the CAEAGLLayer and setup out the rendering context
         // Configure the CAEAGLLayer and setup out the rendering context
+        CGFloat scale = [[UIScreen mainScreen] scale];
         CAEAGLLayer* layer = (CAEAGLLayer *)self.layer;
         CAEAGLLayer* layer = (CAEAGLLayer *)self.layer;
         layer.opaque = TRUE;
         layer.opaque = TRUE;
         layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
         layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, 
                                    [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, 
                                     kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
                                     kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
+        self.contentScaleFactor = scale;
+        layer.contentsScale = scale;
+        
 		context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
 		context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
         if (!context || ![EAGLContext setCurrentContext:context])
         if (!context || ![EAGLContext setCurrentContext:context])
 		{
 		{
@@ -122,7 +126,7 @@ int getKey(unichar keyCode);
             
             
         glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
         glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
         glViewport(0, 0, framebufferWidth, framebufferHeight);
         glViewport(0, 0, framebufferWidth, framebufferHeight);
-        
+
         // Initialize Internal Defaults
         // Initialize Internal Defaults
         displayLink = nil;
         displayLink = nil;
         defaultFramebuffer = 0;
         defaultFramebuffer = 0;