public override void onEnter() { base.onEnter(); CCSize winSize = CCDirector.sharedDirector().getWinSize(); CCRenderTexture cCPoint = CCRenderTexture.renderTextureWithWidthAndHeight((int)winSize.width, (int)winSize.height); if (cCPoint == null) { return; } cCPoint.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); cCPoint.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); cCPoint.anchorPoint = new CCPoint(0.5f, 0.5f); cCPoint.clear(0f, 0f, 0f, 1f); cCPoint.begin(); this.m_pOutScene.visit(); cCPoint.end(); base.hideOutShowIn(); CCProgressTimer cCProgressTimer = CCProgressTimer.progressWithTexture(cCPoint.Sprite.Texture); cCProgressTimer.Type = this.radialType(); cCProgressTimer.Percentage = 100f; cCProgressTimer.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); cCProgressTimer.anchorPoint = new CCPoint(0.5f, 0.5f); CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { CCProgressFromTo.actionWithDuration(this.m_fDuration, 100f, 0f), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) }; cCProgressTimer.runAction(CCSequence.actions(cCFiniteTimeActionArray)); this.addChild(cCProgressTimer, 2, 2147483647); }
public override void onEnter() { base.onEnter(); // create a transparent color layer // in which we are going to add our rendertextures CCSize size = CCDirector.sharedDirector().getWinSize(); // create the second render texture for outScene CCRenderTexture outTexture = CCRenderTexture.renderTextureWithWidthAndHeight((int)size.width, (int)size.height); if (outTexture == null) { return; } outTexture.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); outTexture.position = new CCPoint(size.width / 2, size.height / 2); outTexture.anchorPoint = new CCPoint(0.5f, 0.5f); // render outScene to its texturebuffer outTexture.clear(0, 0, 0, 1); outTexture.begin(); m_pOutScene.visit(); outTexture.end(); // Since we've passed the outScene to the texture we don't need it. this.hideOutShowIn(); // We need the texture in RenderTexture. CCProgressTimer outNode = CCProgressTimer.progressWithTexture(outTexture.Sprite.Texture); // but it's flipped upside down so we flip the sprite //outNode.Sprite.->setFlipY(true); // Return the radial type that we want to use outNode.Type = radialType(); outNode.Percentage = 100.0f; outNode.position = new CCPoint(size.width / 2, size.height / 2); outNode.anchorPoint = new CCPoint(0.5f, 0.5f); // create the blend action CCAction layerAction = CCSequence.actions ( CCProgressFromTo.actionWithDuration(m_fDuration, 100.0f, 0.0f), CCCallFunc.actionWithTarget(this, base.finish) ); // run the blend action outNode.runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene this.addChild(outNode, 2, kSceneRadial); }
public override void onEnter() { base.onEnter(); ccColor4B _ccColor4B = new ccColor4B(0, 0, 0, 0); CCSize winSize = CCDirector.sharedDirector().getWinSize(); CCLayer cCLayer = new CCLayer(); CCRenderTexture cCPoint = CCRenderTexture.renderTextureWithWidthAndHeight((int)winSize.width, (int)winSize.height); if (cCPoint == null) { return; } cCPoint.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); cCPoint.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); cCPoint.anchorPoint = new CCPoint(0.5f, 0.5f); cCPoint.begin(); this.m_pInScene.visit(); cCPoint.end(); CCRenderTexture cCRenderTexture = CCRenderTexture.renderTextureWithWidthAndHeight((int)winSize.width, (int)winSize.height); cCRenderTexture.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); cCRenderTexture.position = new CCPoint(winSize.width / 2f, winSize.height / 2f); cCRenderTexture.anchorPoint = new CCPoint(0.5f, 0.5f); cCRenderTexture.begin(); this.m_pOutScene.visit(); cCRenderTexture.end(); ccBlendFunc _ccBlendFunc = new ccBlendFunc(1, 1); ccBlendFunc _ccBlendFunc1 = new ccBlendFunc(770, 771); cCPoint.Sprite.BlendFunc = _ccBlendFunc; cCRenderTexture.Sprite.BlendFunc = _ccBlendFunc1; cCLayer.addChild(cCPoint); cCLayer.addChild(cCRenderTexture); cCPoint.Sprite.Opacity = 255; cCRenderTexture.Sprite.Opacity = 255; CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { CCFadeTo.actionWithDuration(this.m_fDuration, 0), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.hideOutShowIn)), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) }; CCAction cCAction = CCSequence.actions(cCFiniteTimeActionArray); cCRenderTexture.Sprite.runAction(cCAction); this.addChild(cCLayer, 2, 2147483647); }
public override void onEnter() { base.onEnter(); // create a transparent color layer // in which we are going to add our rendertextures ccColor4B color = new ccColor4B(0, 0, 0, 0); CCSize size = CCDirector.sharedDirector().getWinSize(); //CCLayerColor layer = CCLayerColor.layerWithColor(color); CCLayer layer = new CCLayer(); // create the first render texture for inScene CCRenderTexture inTexture = CCRenderTexture.renderTextureWithWidthAndHeight((int)size.width, (int)size.height); if (null == inTexture) { return; } inTexture.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); inTexture.position = new CCPoint(size.width / 2, size.height / 2); inTexture.anchorPoint = new CCPoint(0.5f, 0.5f); // render inScene to its texturebuffer inTexture.begin(); m_pInScene.visit(); inTexture.end(); // create the second render texture for outScene CCRenderTexture outTexture = CCRenderTexture.renderTextureWithWidthAndHeight((int)size.width, (int)size.height); outTexture.Sprite.anchorPoint = new CCPoint(0.5f, 0.5f); outTexture.position = new CCPoint(size.width / 2, size.height / 2); outTexture.anchorPoint = new CCPoint(0.5f, 0.5f); // render outScene to its texturebuffer outTexture.begin(); m_pOutScene.visit(); outTexture.end(); // create blend functions ccBlendFunc blend1 = new ccBlendFunc(OGLES.GL_ONE, OGLES.GL_ONE); // inScene will lay on background and will not be used with alpha ccBlendFunc blend2 = new ccBlendFunc(OGLES.GL_SRC_ALPHA, OGLES.GL_ONE_MINUS_SRC_ALPHA); // we are going to blend outScene via alpha // set blendfunctions inTexture.Sprite.BlendFunc = blend1; outTexture.Sprite.BlendFunc = blend2; // add render textures to the layer layer.addChild(inTexture); layer.addChild(outTexture); // initial opacity: inTexture.Sprite.Opacity = 255; outTexture.Sprite.Opacity = 255; // create the blend action CCAction layerAction = CCSequence.actions ( CCFadeTo.actionWithDuration(m_fDuration, 0), CCCallFunc.actionWithTarget(this, (base.hideOutShowIn)), CCCallFunc.actionWithTarget(this, (base.finish)) ); //// run the blend action outTexture.Sprite.runAction(layerAction); // add the layer (which contains our two rendertextures) to the scene addChild(layer, 2, kSceneFade); }