Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

srikanthrongali

macrumors newbie
Original poster
Apr 30, 2010
21
0
I am writing a game in cocos2d. I am using a function restartDirector in AppDelegate class.
Code:
-(void)restartDirector{

	[[CCDirector sharedDirector] end];

	[[CCDirector  sharedDirector] release];

	if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] )
	[CCDirector setDirectorType:CCDirectorTypeDefault];

	[[CCDirector sharedDirector] setPixelFormat:kPixelFormatRGBA8888];
	[CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];

	[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
	[[CCDirector sharedDirector] setDisplayFPS:YES];
	[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];

	[[CCDirector sharedDirector] attachInView:window];

}
This function I called in one of the game Scene .

-(void)PracticeMethod:(id)sender
{
	[MY_DELEGATE restartDirector];

	CCScene *endPageScene = [CCScene node];
	CCLayer *endPageLayer = [DummyScene node];

	[endPageScene addChild:endPageLayer];

	[[CCDirector sharedDirector] runWithScene:endPageScene]; 

//	[[CCDirector sharedDirector] replaceScene:endPageScene];
}
When used the replaceScene, there is no problem in game but the memory of abject allocation is high(I checked in leaks tool).
So I used runWithScene.
But , while using these when the scene DummyScene is loaded the sprites, labels in it are displayed by white boxes. I cannot see the sprites are labels.
I am using replaceScene everything thing is working fine.
this is my problem.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.