Hi guys i am having the following problem, i have a uikit app which has 4 games, each game loads a Cocos2d scene. So i have a menu and 5 other uiviewcontrollers.
The menu viewcontroller is pure uikit, when i choose a game i load another viewcontroller which loads initializes cocos2d. When i go back to the menu Cocos2d is unloaded.
This is working great so far, i can go to one game, back to the menu, load another game and so on.
The actual problem i am having is when i want to go from one game to another game. The second game loads, the interactivity works, but the elements just don't move, as if the screen was frozen or not updating the elements positions. (i can tell it is responding to touches because i can touch buttons and hear sounds play accordingly as well as the logic working).
this is the code i am using:
when loading a game:
GameDress_iPad * gw = [[GameDress_iPad alloc]
initWithNibName:@"GameDress_iPad" bundle:nil];
[gw.view setAlpha:0];
AppDelegate_iPad * app = (AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
UIWindow * w = app.window;
[w addSubview:gw.view];
[UIView beginAnimations:nil context:nil];
[gw.view setAlpha:1];
[UIView commitAnimations];
When unloading it:
CCDirector *director = [CCDirector sharedDirector];
[[director openGLView] removeFromSuperview];
[director end];
[self.view removeFromSuperview];
[self release];
MainMenu_iPad * gw = [[MainMenu_iPad alloc]
initWithNibName:@"MainMenu_iPad" bundle:nil];
[gw.view setAlpha:0];
AppDelegate_iPad * app = (AppDelegate_iPad *)[[UIApplication sharedApplication] delegate];
UIWindow * w = app.window;
[w addSubview:gw.view];
[UIView beginAnimations:nil context:nil];
[gw.view setAlpha:1];
[UIView commitAnimations];
Any help is welcome, thanks!