Cocos2D reloads white screen error

I am developing a game. When we create an EaglView and runwithscene, it works great for the first time.

// TAKE THE SHARED DIRECTOR director = [CCDirector sharedDirector]; // IF THIS IS FIRST OPENING TIME FOR GAME if (director.openGLView == nil) { // CREATE THE GAME if ([CCDirector setDirectorType:kCCDirectorTypeDisplayLink] == NO) { [CCDirector setDirectorType:kCCDirectorTypeDefault]; } [director setAnimationInterval:1.0/60]; NSArray* subviews = self.view.subviews; for (int i = 0; i < [subviews count]; i++) { UIView* subview = [subviews objectAtIndex:i]; if ([subview isKindOfClass:[EAGLView class]]) { [director setOpenGLView:(EAGLView*)subview]; [director runWithScene:[HelloWorldLayer scene]]; break; } } } // IF USER WANTS TO OPEN THIS LEVEL SECOND TIME (OR MORE THAN ONE) else { [director startAnimation]; [director replaceScene:[HelloWorldLayer scene]]; } 

I don’t know why, but when I return to the menu and try to restart the game, a white screen appears (I set a breakpoint and noticed that the game code is working and initializing), but only a white screen appears.

I appreciate the help. Thanks

+4
source share
1 answer

may be its root view controller. Background view.For Ex, Window is the root view controller, and its background is white. you set your scene and watch it. When you return, your root view controller will be display.so, set the background of your Root view (Like-Window) controller.

0
source

Source: https://habr.com/ru/post/1433232/


All Articles