0

I am developing an iOS app using Cocos2D and I encountered a very strange problem as follows.

At the beginning, there is only a full version, and everything works well on both iPad2 and 3. Now, I plan to create a lite version, so I registered a new certificate on Apple website. Using the lite certificate, the lite build produced in Xcode can work on iPad2 well, but the display on iPad3 becomes half size of the screen. It seems that the problem is because of the new certificate, would you please help me answer the question? Thanks in advance.

Jaffa
  • 12,442
  • 4
  • 49
  • 101
Dali
  • 1

2 Answers2

0

It's not your certificate. You need to allow for the scaling on the iPad3 as it has a retina display.

You also need to provide new textures/images appropriately sized to take advantage of the retina display. You could use the existing non-retina artwork and it'll probably look okay. But it wont look perfect.

I've not used cocos2d. Are you using GlKit also, as GLkView expects you to allow for the scale on secreen.

For example if you just want to upscale what you've already created you could look for where the viewport gets set:

int scale = 1; // default is 1 - non-retina. It's adjusted below according to the scale on the device

    if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]
        && [[UIScreen mainScreen] scale] == 2.0) {
        scale = [[UIScreen mainScreen] scale];
    }

    // Set the viewport
    glViewport(0, 0, backingWidth*scale, backingHeight*scale);

I wouldn't do this, or I wouldn't only do this as it doesn't really fix your problem properly. I'm also surprised that cocos2d doesn't already have a way to handle this built in.

Also what is the view that you render into is it a EAGLView : UIView using an CAEAGLLayer to render your OPENGL or is it a GLKView. If you change it from the latter this will also get rid of the problem in the same way the code pasted in will get rid of it. Neither of which are the best way to approach it. But it's a simple answer to your problem, perhaps someone else would care to write a more detailed response.

AppHandwerker
  • 1,758
  • 12
  • 22
0

There are two things you can consider when fixing the problem:

  1. Make sure you have copies of your artwork at 2x the resolution with '-hd' suffix, e.g. "ninja.png" and "ninja-hd.png". It's cocos' way of doing the @2x by iOS.
  2. Check if retina is enabled in your code when appropriate:

    [[CCDirector sharedDirector] enableRetinaDisplay: YES];

Hope that helps! And as mentioned before - that's definitely not a certificate issue! (lucky for you ;) )

Fszczemton
  • 471
  • 3
  • 5