Ejemplo n.º 1
0
        /** creates an action with duration and opacity */
        public static CCFadeTo actionWithDuration(float duration, byte opacity)
        {
            CCFadeTo pFadeTo = new CCFadeTo();
            pFadeTo.initWithDuration(duration, opacity);

             return pFadeTo;
        }
Ejemplo n.º 2
0
        public static CCFadeTo actionWithDuration(float duration, byte opacity)
        {
            CCFadeTo cCFadeTo = new CCFadeTo();

            cCFadeTo.initWithDuration(duration, opacity);
            return(cCFadeTo);
        }
Ejemplo n.º 3
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCFadeTo cCFadeTo = null;

            if (pZone == null || pZone.m_pCopyObject == null)
            {
                cCFadeTo = new CCFadeTo();
                pZone    = new CCZone(cCFadeTo);
            }
            else
            {
                cCFadeTo = (CCFadeTo)pZone.m_pCopyObject;
            }
            base.copyWithZone(pZone);
            cCFadeTo.initWithDuration(this.m_fDuration, this.m_toOpacity);
            return(cCFadeTo);
        }
Ejemplo n.º 4
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCFadeTo pCopy = null;
            if(pZone != null && pZone.m_pCopyObject != null) 
            {
                //in case of being called at sub class
                pCopy = (CCFadeTo)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCFadeTo();
                pZone = pNewZone = new CCZone(pCopy);
            }

            base.copyWithZone(pZone);

            pCopy.initWithDuration(m_fDuration, m_toOpacity);
	
            return pCopy;
        }
Ejemplo n.º 5
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone   pNewZone = null;
            CCFadeTo pCopy    = null;

            if (pZone != null && pZone.m_pCopyObject != null)
            {
                //in case of being called at sub class
                pCopy = (CCFadeTo)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCFadeTo();
                pZone = pNewZone = new CCZone(pCopy);
            }

            base.copyWithZone(pZone);

            pCopy.initWithDuration(Duration, m_toOpacity);

            return(pCopy);
        }
Ejemplo n.º 6
0
        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);
        }