I find a solution. I can upload ccbi files and run the loading animation at the same time. I don’t know if it’s right, but it works for me. Here is the code. The solution is found in the Cocos2d multipoint test case.
//loading animations here [self pushLoadingAnimation]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ CCGLView *view = (CCGLView*)[[CCDirector sharedDirector] view]; NSAssert(view, @"Do not initialize the TextureCache before the Director"); EAGLContext *auxGLcontext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:[[view context] sharegroup]]; if( [EAGLContext setCurrentContext:auxGLcontext] ) { // load the ccbi files here [self readCCBIfile]; //push the scene in main thread dispatch_async(dispatch_get_main_queue(), ^{ [[CCDirector sharedDirector] replaceScene:world]; }); glFlush(); [EAGLContext setCurrentContext:nil]; } else { CCLOG(@"cocos2d: ERROR: TetureCache: Could not set EAGLContext"); } });
source share