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
source share