Problem of Sprites and labels are displayed by white boxes.
- by srikanth rongali
I am writing a game in cocos2d. I am using a function restartDirector in AppDelegate class.
-(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 and labels.
If I am using replaceScene everything thing is working fine but the memory allocation is high.
this is my problem.
Thank you.