2012-04-25 15 views
1

iPadで動作している小さなゲームアプリケーションに問題があります。私はiPadの網膜ディスプレイとシミュレータのIOS 5.1を昼食するとき、アプリケーションは、デフォルトの画像@ x2で始まり、その後に画像が黒い画面に移動します。通常のiPadでは、iOS 5.1シミュレータは正常に動作します。 Xcodeはこれだけを教えてくれます:iPadの網膜ディスプレイの黒い画面

2012-04-25 14:24:26.978 AppName[83696:10a03] cocos2d: Frame interval: 1 
2012-04-25 14:24:26.980 AppName[83696:10a03] cocos2d: surface size: 1536x2048 

ご存じですか? ありがとう


@Smamimホサイン:私は私の完全なAppdelegate.m

#import "cocos2d.h" 

#import "AppDelegate.h" 
#import "GameConfig.h" 
#import "Intro.h" 
#import "RootViewController.h" 

@implementation AppDelegate 

@synthesize window; 

- (void) removeStartupFlicker 
{ 

//#if GAME_AUTOROTATION == kGameAutorotationUIViewController 


//#endif // GAME_AUTOROTATION == kGameAutorotationUIViewController 
} 
- (void) applicationDidFinishLaunching:(UIApplication*)application 

[director setProjection:kCCDirectorProjection2D] 
{ 


    // Init the window 
    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 


    if(! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink]) 
     [CCDirector setDirectorType:kCCDirectorTypeDefault]; 

    [director setProjection:kCCDirectorProjection2D] 
    CCDirector *director = [CCDirector sharedDirector]; 

    // Init the View Controller 
    viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; 
    viewController.wantsFullScreenLayout = YES; 

    // 
    // Create the EAGLView manually 
    // 1. Create a RGB565 format. Alternative: RGBA8 
    // 2. depth format of 0 bit. Use 16 or 24 bit for 3d effects, like CCPageTurnTransition 
    // 
    // 
    EAGLView *glView = [EAGLView viewWithFrame:[window bounds] 
            pixelFormat:kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8 
            depthFormat:0      // GL_DEPTH_COMPONENT16_OES 
         ]; 

// // 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"); 


#if GAME_AUTOROTATION == kGameAutorotationUIViewController 
    [director setDeviceOrientation:kCCDeviceOrientationPortrait]; 
#else 
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft]; 
#endif 

    [director setAnimationInterval:1.0/60]; 
    [director setDisplayFPS:NO]; 
    [director setDepthTest:NO]; 

    // 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]; 

    // 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]; 


    // Removes the startup flicker 
    [self removeStartupFlicker]; 

    // Run the intro Scene 
    [[CCDirector sharedDirector] runWithScene: [Intro scene]]; 
} 


- (void)applicationWillResignActive:(UIApplication *)application { 
    [[CCDirector sharedDirector] pause]; 
} 

- (void)applicationDidBecomeActive:(UIApplication *)application { 
    [[CCDirector sharedDirector] resume]; 
} 

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application { 
    [[CCDirector sharedDirector] purgeCachedData]; 
} 

-(void) applicationDidEnterBackground:(UIApplication*)application { 
    [[CCDirector sharedDirector] stopAnimation]; 
} 

-(void) applicationWillEnterForeground:(UIApplication*)application { 
    [[CCDirector sharedDirector] startAnimation]; 
} 

- (void)applicationWillTerminate:(UIApplication *)application { 
    CCDirector *director = [CCDirector sharedDirector]; 

    [[director openGLView] removeFromSuperview]; 

    [viewController release]; 

    [window release]; 

    [director end]; 
} 

- (void)applicationSignificantTimeChange:(UIApplication *)application { 
    [[CCDirector sharedDirector] setNextDeltaTimeZero:YES]; 
} 

- (void)dealloc { 
    [[CCDirector sharedDirector] end]; 
    [window release]; 
    [super dealloc]; 
} 

@end 
+1

あなたはcocos2d-iphoneのどのバージョンを使用していますか? – Hailei

+0

@Halley cocos2d-iphone-2.0-rc1 – user1322754

+0

詳細を教えていただけますか?位置やアンカーポイントなど、シーンをどのように実装したかを知る必要があります。また、AppDelegateで網膜表示を適切に有効にしましたか?もし(![ディレクターenableRetinaDisplay::YES])私のAppdelegate.mで –

答えて

13

が でこのコード行を試し置く同じエラー - (BOOL)アプリケーション:(のUIApplication *)アプリケーションdidFinishLaunchingWithOptions:

[ディレクターのsetProjection:kCCDirectorProjection2D];

が、これはあなたの問題を解決することを願っています。

+0

は今、私はこれを持っている、助けてくれてありがとう:} - (無効)applicationDidFinishLaunching:(のUIApplication *)アプリケーション - (BOOL)アプリケーション:(のUIApplication *)applicationdidFinishLaunchingWithOptions:[ディレクターのsetProjection:kCCDirectorProjection2D] {しかし、エラーが表示されます。予想される方法body - – user1322754

+0

この行を追加してください[director setProjection:kCCDirectorProjection2D];それは私と一緒に働く –

+0

感謝@ShamimHossain applicationdidFinishLaunchingWithOptions方法で –

関連する問題