Exemple #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);
        }
Exemple #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);
        }
Exemple #3
0
        public override void Visit()
        {
            if (!Visible || Window == null)
            {
                return;
            }

            // Set camera view/proj matrix even if ChildClippingMode is None
            if (Camera != null)
            {
                Window.DrawManager.ViewMatrix       = Camera.ViewMatrix;
                Window.DrawManager.ProjectionMatrix = Camera.ProjectionMatrix;
            }

            if (ChildClippingMode == CCClipMode.None)
            {
                base.Visit();
                return;
            }

            Window.DrawManager.PushMatrix();

            if (Grid != null && Grid.Active)
            {
                Grid.BeforeDraw();
                TransformAncestors();
            }

            Window.DrawManager.SetIdentityMatrix();

            BeforeDraw();

            if (!noDrawChildren && Children != null)
            {
                SortAllChildren();

                CCNode[] arrayData = Children.Elements;
                int      count     = Children.Count;
                int      i         = 0;

                // draw children zOrder < 0
                for (; i < count; i++)
                {
                    CCNode child = arrayData[i];
                    if (child.ZOrder < 0)
                    {
                        if (child.Visible)
                        {
                            child.Visit();
                        }
                    }
                    else
                    {
                        break;
                    }
                }

                Draw();

                // draw children zOrder >= 0
                for (; i < count; i++)
                {
                    arrayData[i].Visit();
                }
            }
            else
            {
                Draw();
            }

            AfterDraw();

            if (Grid != null && Grid.Active)
            {
                Grid.AfterDraw(this);
            }

            Window.DrawManager.PopMatrix();
        }