cocos2d/cocos2d-x — pull request #1366 by dualface (2012-09-24 03:08:17+00:00)
Title: Set Design Resolution on iOS, with Retina Display Edit 

### REASON

On iOS, after called enableRetina(), setDesignResolutionSize() will not be able to use. This makes iOS and Android devices can not use the same design resolution.

With modified EAGLView. Developer will no longer need to call enableRetina ().Only need to call setDesignResolutionSize (960, 640), can specify a valid design resolution on iOS and Android, and is automatically enable Retina Display.

.

### HOW TO USE

Change AppController.mm, add codes:

// Add the view controller's view to the window and display.
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH_COMPONENT16
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0 ];

// ==== ADD CODES BELOW ====
// Override point for customization after application launch.
if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) {
CGFloat scale = [[UIScreen mainScreen] scale];
if(scale == 2.0) {
// for iPhone4/4S/5, New iPad
[__glView setDesignContentScaleFactor:scale];
}
}
// ==== ADD CODES ABOVE ====

.

Change AppDelegate.cpp, comment on codes:

// No longer need this
// pDirector->enableRetinaDisplay(true);

.

### TEST RESULTS

Working on iPhone Simulator with Retina Display (3.5inch, 4.0inch), iPad Simulator with Retina Display.

.

### THANKS

FROM kunlun.com, THANKS.