【问题标题】:CCGLView flicker issueCCGLView 闪烁问题
【发布时间】:2015-01-04 07:05:28
【问题描述】:

我的 viewController 中有一个 CCGLView,在完成动画后,我试图用一个空场景替换 CCGLView 中的场景。问题是,在替换场景时,我可以观察到闪烁。我想避免它,我提供下面的代码。为了避免闪烁,我必须进行哪些更改?

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];

【问题讨论】:

    标签: ios objective-c iphone cocos2d-iphone cocos3d


    【解决方案1】:

    一个问题是CC3Layerscene 属性返回CCScene 实例,而不是您期望的CC3Scene 实例。无论如何,在您的代码中,scene 属性将返回nil,因为它尚未设置。请尝试改用 cc3Scene 属性。

    你没有指出你试图在哪里运行这段代码,但是如果我将以下代码添加到CC3HelloWorld模板应用程序的nodeSelected:byTouchEvent:at:方法中,过渡运行顺利,没有任何闪烁:

    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]];
    

    ...比尔

    【讨论】:

      猜你喜欢
      • 2016-03-06
      • 2012-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-27
      • 2018-08-04
      • 2017-02-01
      相关资源
      最近更新 更多