1

I have a CCGLView in my viewController, after completing the animations I'm trying to replace scene in the CCGLView with an empty scene. The issue is that while replacing the scene there is a flicker which I can observe. I want to avoid it, I'm providing the code below. What I have to change to avoid that flicker?

CC3Layer* layer=[[CC3Layer alloc]init];
CC3Scene* scene= (CC3Scene*)layer.scene;
scene.backdrop= [CC3Backdrop nodeWithColor:ccc4f(0.0/255.0, 0.0/255.0, 0.0/255.0, 0.0)];
[scene updateScene];
[self.director replaceScene:[layer asCCScene] withTransition:[CCTransition transitionCrossFadeWithDuration:1.0]];
[self.director stopAnimation];
Chengappa C D
  • 1,841
  • 1
  • 12
  • 19

1 Answers1

0

One issue is that the scene property of CC3Layer returns the CCScene instance, and not the CC3Scene instance you are expecting. In any case, in your code, the scene property will return nil, because it has not yet been set. Try using the cc3Scene property, instead.

You haven't indicated where you are trying to run this code, but if I add the following code to the nodeSelected:byTouchEvent:at: method of the CC3HelloWorld template app, the transition runs smoothly, without any kind of flicker:

CC3Layer* layer=[[CC3Layer alloc]init];
CC3Scene* scene= layer.cc3Scene;
scene.backdrop= [CC3Backdrop nodeWithColor:ccc4f(0.0, 0.5, 0.5, 1.0)];
[CCDirector.sharedDirector replaceScene:[layer asCCScene] withTransition:[CCTransition transitionCrossFadeWithDuration:1.0]];

...Bill

Bill Hollings
  • 2,344
  • 17
  • 25