Ejemplo n.º 1
0
        protected override void InitialiseScenes()
        {
            if (Layer == null || Viewport == null)
            {
                return;
            }

            base.InitialiseScenes();

            SetupTransition();

            // create a transparent color layer
            // in which we are going to add our rendertextures
            var    bounds       = Layer.VisibleBoundsWorldspace;
            CCRect viewportRect = Viewport.ViewportInPixels;

            // create the second render texture for outScene
            CCRenderTexture texture = new CCRenderTexture(bounds.Size, viewportRect.Size);

            texture.Position    = bounds.Center;
            texture.AnchorPoint = CCPoint.AnchorMiddle;

            // Temporarily add render texture to get layer/scene properties
            Layer.AddChild(texture);
            texture.Visible = false;

            // Render outScene to its texturebuffer
            texture.BeginWithClear(0, 0, 0, 1);
            SceneNodeContainerToBeModified.Visit();
            texture.End();

            texture.Visible = true;

            // No longer want to render texture
            RemoveChild(texture);

            // Since we've passed the outScene to the texture we don't need it.
            if (SceneNodeContainerToBeModified == OutSceneNodeContainer)
            {
                HideOutShowIn();
            }

            CCProgressTimer node = ProgressTimerNodeWithRenderTexture(texture);

            // create the blend action
            var layerAction = new CCProgressFromTo(Duration, From, To);

            // add the layer (which contains our two rendertextures) to the scene
            AddChild(node, 2, SceneRadial);

            // run the blend action
            node.RunAction(layerAction);
        }
Ejemplo n.º 2
0
        protected override void InitialiseScenes()
        {
            if (Layer == null)
            {
                return;
            }

            base.InitialiseScenes();

            SetupTransition();

            // create a transparent color layer
            // in which we are going to add our rendertextures
            var    bounds       = Layer.VisibleBoundsWorldspace;
            CCRect viewportRect = new CCRect(Viewport.Bounds);

            // create the second render texture for outScene
            CCRenderTexture texture = new CCRenderTexture(bounds.Size, viewportRect.Size);

            texture.Sprite.Position    = bounds.Center;
            texture.Sprite.AnchorPoint = CCPoint.AnchorMiddle;


            // Render outScene to its texturebuffer
            texture.BeginWithClear(0, 0, 0, 255);
            var worldTransform = SceneNodeContainerToBeModified.AffineWorldTransform;

            SceneNodeContainerToBeModified.Visit(ref worldTransform);
            texture.End();

            // Since we've passed the outScene to the texture we don't need it.
            if (SceneNodeContainerToBeModified == OutSceneNodeContainer)
            {
                HideOutShowIn();
            }

            CCProgressTimer node = ProgressTimerNodeWithRenderTexture(texture);

            // create the blend action
            var layerAction = new CCProgressFromTo(Duration, From, To);

            // add the layer (which contains our two rendertextures) to the scene
            Layer.AddChild(node, 2);

            // run the blend action
            node.RunAction(layerAction);
        }