我正在开发一个游戏。当我们创建 EaglView 并 runwithscene 时,它第一次可以正常工作。
// 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]];
}
我不知道为什么,但是当我返回菜单并尝试重新加载游戏时,出现一个白屏,(我设置断点并观察到游戏代码正在运行和初始化),但只出现白屏。
我感谢您的帮助。谢谢