情况:
iOS 上的 cocos2d。在模拟器中,我的 FPS 在标准分辨率设备模式下显示为 60,在视网膜设备模式下显示为 30(正好是一半)。谷歌搜索没有立即产生结果……有什么原因吗?
代码:
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
// Init the window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Init the View Controller
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
viewController.wantsFullScreenLayout = YES;
// Try to use CADisplayLink director
// if it fails (SDK < 3.1) use the default director
if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:kCCDirectorTypeDefault];
// Create glview
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
pixelFormat:kEAGLColorFormatRGBA8
depthFormat:0
];
// make the OpenGLView a child of the view controller
[viewController setView:glView];
// make the View Controller a child of the main window
[window addSubview: viewController.view];
[window makeKeyAndVisible];
// Create director
director = [CCDirector sharedDirector];
// attach the openglView to the director
[director setOpenGLView:glView];
#if GAME_AUTOROTATION == kGameAutorotationUIViewController
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
#else
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
#endif
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:YES];
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
// Set premultiplied alpha
[CCTexture2D PVRImagesHavePremultipliedAlpha:YES];
// 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];
// Enable High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
[director enableRetinaDisplay:YES]
[self removeStartupFlicker];
[SceneManager goLoadingScreen];
}
更新:
也许这只是一个模拟器问题?见http://www.cocos2d-iphone.org/forum/topic/20367
为什么不在设备上进行测试?
而且我不能只在我的视网膜设备上进行测试,因为我无知地将我的 iPhone4 升级到了最新版本的 iOS,而且我还没有准备好为 Lion 更新支付 30 美元......