高资源 自从v0.99.4开始,导演可以设置颜色来呈递缓冲再高资源模型里: // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices if ([UIScreen instancesRespondToSelector:@selector(scale)]) [director setContentScaleFactor:[[UIScreen mainScreen] scale]]; 从v0.99.5开始,开始支持视网膜屏幕显示: // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices if( ! [director enableRetinaDisplay:YES] ) CCLOG(@"Retina Display Not supported"); 它是怎么工作的: 如果你有一台iphon4,显示方案是960*640
// set FPS at 60 [director setAnimationInterval:1.0/60];
// Display FPS: yes [director setDisplayFPS:YES];
// Create an EAGLView with a RGB8 color buffer, and a depth buffer of 24-bits EAGLView *glView = [EAGLView viewWithFrame:[window bounds] pixelFormat:kEAGLColorFormatRGBA8 // RGBA8 color buffer depthFormat:GL_DEPTH_COMPONENT24_OES // 24-bit depth buffer preserveBackbuffer:NO sharegroup:nil //for sharing OpenGL contexts between threads multiSampling:NO //YES to enable it numberOfSamples:0 //can be 1 - 4 if multiSampling=YES ];
// attach the openglView to the director [director setOpenGLView:glView];
// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices if( ! [director enableRetinaDisplay:YES] ) CCLOG(@"Retina Display Not supported");
// make the OpenGLView a child of the main window [window addSubview:glView];
// make main window visible [window makeKeyAndVisible];
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565 // You can change anytime. [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];