How to enable iPhone5 resolution 1136x640

Hi,

How to enable 1136x640 resolution on newest iPhone5, I’m still using cocos2d-x 1.0.x, but if it is not possible to use it anymore how to do it on cocos2d-x?

KR,
Michal
http://privateasteroid.com/patientia-game/

v2.0.2 use a improved design to deal with multi-resolutions.

enum ResolutionPolicy
{
    // The entire application is visible in the specified area without trying to preserve the original aspect ratio. 
    // Distortion can occur, and the application may appear stretched or compressed.
    kResolutionExactFit,
    // The entire application fills the specified area, without distortion but possibly with some cropping, 
    // while maintaining the original aspect ratio of the application.
    kResolutionNoBorder,
    // The entire application is visible in the specified area without distortion while maintaining the original 
    // aspect ratio of the application. Borders can appear on two sides of the application.
    kResolutionShowAll,

    kResolutionUnKnown,
};

Walzer Wang wrote:

v2.0.2 use a improved design to deal with multi-resolutions.
[…]

Thanks, just to make sure, there is no way to do anything similar in cocos2d-x 1.0.x? I need to upgrade to 2.0.2?

KR,
Michał
http://privateasteroid.com/patientia-game/

cocos2d-x v2.0.3

I am trying to include 1136x640 images for iPhone 5 but no matter what I do, the screen is always letter boxed - even though my images are 1136x640. Also, since iPhone 5 is a Retina display, how can I enableRetinaDisplay(true) and setDesignResolutionSize() at the same time.

@
CCFileUtils::sharedFileUtils()->setResourceDirectory(“iphone5hd/”);
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(1136, 640, kResolutionNoBorder);
@

Hi,

all I did was to turn retina on (and two sets of images normal and retina) and add fix for iOS6 screen orientation.

else if (target == kTargetIphone)
    {
        // iphone        
        if (pDirector->enableRetinaDisplay(true))
        {
            // iphone hd
            CCFileUtils::sharedFileUtils()->setResourceDirectory("iphonehd");
        }
        else 
        {
            CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
        }
    }

M

Thanks Michal G, yes I had already tried that as well. My problem was due to having an old Xcode project. I added “Default-568h@2x.png” to the project and used it for the retina 4-inch launch image. Using the code you mention and the default image works perfectly!

http://stackoverflow.com/questions/12398819/iphone-5-letterboxing-screen-resize

I’m still using cocos2d-x 1.0.x. But I’d like to use the resolution 1136x640.

Load bigger images isn’t enough for me. I’d like a large canvas, and in my code, when I use

CCSize size = CCDirector::sharedDirector()->getWinSizeInPixels();
or
CCSize size = CCDirector::sharedDirector()->getWinSize();

And the system should return 1136x640.
Is this possible?

Thanks

Hello!

`Michael G … I’ve seen your solution and I have a doubt… Do I have to create 3 directories? iPhone normal, iPhone 4, iPhone 5? OR just 2 directories? iPhone normal and iPhone 4 & 5?

When you enable retina display and choose the directory… How can I know if its a 3.5-inch display (iPhone 4) or a 4.0-inch display (iPhone 5)? Do I have to put for example… background-568h`2x.png (iPhone 5) and another file background@2x.png (iPhone 4) to the iphoneHD directory?

Thank you!

@Alejandro Andrade

Actually I made iphonehd that simply fits for both iphone 5 and a retina one, just on the older retinas, some of the images are cut (but in my case these are background images only, so no problem)

M

@Michal G Thank you! Now I get it :smiley:

Just add a new default png at 1136x640 called Default-568h@2x.png, and your app now runs at that resolution! I was using an old version of cocos2dx and no upgrade necessary (apart from layout issues :slight_smile: )

http://stackoverflow.com/questions/12398819/iphone-5-letterboxing-screen-resize

Thanks for the solution @Tom :slight_smile:

could we get an updated solution ?

I added an Default-568h@2x.png file in my ressource directory;
(it now appears in the retina 4inch launch image)

I’m trying to do 640×1136 but it’s cut up and down; and

CCSize size = CCDirector::sharedDirector()->getWinSizeInPixels();

returns 640.000000 frameSize.height=960.000000

is there an example somewhere ?

which ResolutionPolicy should I use ?

there is no more pDirector->enableRetinaDisplay(true) in the code; isn t it ???

It seems to work in 1136x640 in the simulator when i choose retina 4inch but not on my phone; anyone has an idea ?

oups, my mistake: I had forgotten to select the “supported interface orientations”

franck - wrote:

oups, my mistake: I had forgotten to select the “supported interface orientations”

Thanks! This solves the problem and saves me a headache.

@Tom it works! thanks!