Hello,
I have a normal xcode app with an animation-module as a sub-part.
When starting the animation-part I create the director, including the scenes, layers and sprites - all meant to be only temporary - communicating back and forth with the "normal" app. The director is defined as an ivar.
MyInit...
if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType:kCCDirectorTypeThreadMainLoop];
director = [CCDirector sharedDirector];
To end the animation I do the following:
EAGLView *view = [director openGLView];
[view removeFromSuperview];
// kill the director
[director end];
[director release]; //if not here, where else?
director = nil;
While it does the trick of letting me run MyInit repeatedly without getting an error from [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] I am not sure if this is the best way of doing this.
Normally I would put the release in the dealloc, but this doesn't get called on time.
Please advice - many thanks!