Cocos2D Director Pause/Resume Issue
Posted
by Aditya
on Stack Overflow
See other posts from Stack Overflow
or by Aditya
Published on 2009-12-17T13:03:52Z
Indexed on
2010/04/25
20:23 UTC
Read the original article
Hit count: 567
I am trying to play a .gif animation in cocos2D. For this i am using the library glgif. Now, to display the animation i am pausing the Director, adding a subview to show the animation and after the animation is done i am resuming the Director. However, I am not able to resume the state of the Director and it shows blank. So I tried this without pausing and resuming this Director and it still did not work.I also tried detaching the director before tha animation and adding it back afterwards and even that did not work.
So is there a way to pause/suspend the Director in the application and properly restore is back?
Thanks.
Code sample:
[[Director sharedDirector] pause];
[[Director sharedDirector] detach];
AppDelegate *del = [[UIApplication sharedApplication] delegate];
[del.window addSubview:del.viewController.view];
[del.window makeKeyAndVisible]; // this is code to call glgif class and start anim.
//code to resume the director
AppDelegate *del = [[UIApplication sharedApplication] delegate];
[[Director sharedDirector] resume];
[[Director sharedDirector] attachInView:del.window];
MScene *m = [MScene node];
[[Director sharedDirector] replaceScene:m];
© Stack Overflow or respective owner