2012-06-10 52 views
2

現狀:iOS上
的cocos2d。在模擬器中,我的FPS在標準分辨率設備模式下顯示60,在視網膜設備模式下顯示30(正好一半)。谷歌搜索沒有立竿見影的效果......任何原因爲什麼?cocos2d FPS在視網膜上一半的原因是什麼?

代碼:

- (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的最新版本,我不準備掏出$ 30,獅子更新尚未...

回答

10

原因可能沒有明確的iPhone硬件加速的iPhone模擬器。在設備上測試,一切都應該沒問題。

我的遊戲在iPad視網膜模擬器8FPS,但60 FPS的真實設備。用真實設備測試遊戲性能,不要擔心模擬器。

+0

@X斜槓似乎是這樣的情況。感謝您的輸入。 – sean

+0

您正在模擬器上測試fps ....? –

+0

不,我告訴他在真實設備上測試FPS,而不是在模擬器上,說我的只有8 FPS僅僅是一個例子 –

相關問題