2

状況:
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ドルを支払う準備ができていないため、網膜デバイスでテストすることはできません...

4

1 に答える 1

10

理由は、iPhoneシミュレータの明示的なGPUハードウェアアクセラレーションがないためかもしれません。デバイスでテストしてください。すべて問題ないはずです。

私のゲームはiPad網膜シミュレーターでは8fpsですが、実際のデバイスでは60FPSです。実際のデバイスでゲームのパフォーマンスをテストし、シミュレーターについて心配する必要はありません。

于 2012-06-10T17:26:38.377 に答える