Example #1
0
        public override void Setup()
        {
            const int depth = 9;

            CCNode parent = this;

            for (int i = 0; i < depth; i++)
            {
                int size = 225 - i * (225 / (depth * 2));

                CCClippingNode clipper = new CCClippingNode();
                clipper.ContentSize    = new CCSize(size, size);
                clipper.AnchorPoint    = new CCPoint(0.5f, 0.5f);
                clipper.Position       = new CCPoint(parent.ContentSize.Width / 2, parent.ContentSize.Height / 2);
                clipper.AlphaThreshold = 0.05f;
                clipper.RunAction(new CCRepeatForever(new CCRotateBy(i % 3 != 0 ? 1.33f : 1.66f, i % 2 != 0 ? 90 : -90)));
                parent.AddChild(clipper);

                CCNode stencil = new CCSprite(TestResource.s_pPathGrossini);
                stencil.Scale       = 2.5f - (i * (2.5f / depth));
                stencil.AnchorPoint = new CCPoint(0.5f, 0.5f);
                stencil.Position    = new CCPoint(clipper.ContentSize.Width / 2, clipper.ContentSize.Height / 2);
                stencil.Visible     = false;
                stencil.RunAction(new CCSequence(new CCDelayTime(i), new CCShow()));
                clipper.Stencil = stencil;

                clipper.AddChild(stencil);

                parent = clipper;
            }
        }
Example #2
0
        protected override CCClippingNode Clipper()
        {
            CCClippingNode clipper = base.Clipper();

            clipper.AlphaThreshold = 1;
            return(clipper);
        }
Example #3
0
        protected override CCClippingNode Clipper()
        {
            CCClippingNode clipper = base.Clipper();

            clipper.Inverted = true;
            return(clipper);
        }
Example #4
0
        protected override CCClippingNode Clipper()
        {
            CCClippingNode clipper = base.Clipper();

            clipper.AlphaThreshold = 0.05f;
            clipper.Inverted       = true;
            return(clipper);
        }
Example #5
0
        void PositionInWindow(CCClippingNode clipper)
        {
            clipper.Position = clipper.Parent.ContentSize.Center;

            foreach (var child in clipper.Children)
            {
                if (child is CCClippingNode)
                {
                    var clipr = (CCClippingNode)child;
                    clipr.Stencil.Position = clipr.ContentSize.Center;

                    PositionInWindow(clipr);
                }
            }
        }
Example #6
0
        public override void Setup()
        {
            stencil          = Stencil();
            stencil.Tag      = kTagStencilNode;
            stencil.Position = new CCPoint(50, 50);

            CCClippingNode clipper = Clipper();

            clipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            clipper.Stencil     = stencil;
            AddChild(clipper);

            content          = Content();
            content.Tag      = kTagContentNode;
            content.Position = new CCPoint(50, 50);
            clipper.AddChild(content);
        }
Example #7
0
        public override void Setup()
        {
            CCClippingNode clipper = new CCClippingNode()
            {
                Tag = kTagClipperNode
            };

            clipper.ContentSize = new CCSize(200, 200);
            clipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            AddChild(clipper);

            CCDrawNode stencil = new CCDrawNode();

            CCPoint[] rectangle =
            {
                new CCPoint(0,                                                  0),
                new CCPoint(clipper.ContentSize.Width,                          0),
                new CCPoint(clipper.ContentSize.Width, clipper.ContentSize.Height),
                new CCPoint(0,                         clipper.ContentSize.Height),
            };

            CCColor4F white = new CCColor4F(0, 0, 0, 1);

            stencil.DrawPolygon(rectangle, 4, white, 0, white);
            clipper.Stencil = stencil;

            CCSprite content = new CCSprite(TestResource.s_back2);

            content.Tag         = kTagContentNode;
            content.AnchorPoint = new CCPoint(0.5f, 0.5f);
            clipper.AddChild(content);

            content.RunAction(new CCRepeatForever(new CCRotateBy(1, 45)));

            m_bScrolling = false;

            // Register Touch Event
            var touchListener = new CCEventListenerTouchAllAtOnce();

            touchListener.OnTouchesBegan = onTouchesBegan;
            touchListener.OnTouchesMoved = onTouchesMoved;
            touchListener.OnTouchesEnded = onTouchesEnded;

            AddEventListener(touchListener);
        }
Example #8
0
        public override void Setup()
        {
            CCSprite target = new CCSprite(TestResource.s_pPathBlock);

            target.AnchorPoint = CCPoint.Zero;
            target.Scale       = 3;

            m_pOuterClipper = new CCClippingNode();

            CCAffineTransform tranform = CCAffineTransform.Identity;

            tranform = CCAffineTransform.ScaleCopy(tranform, target.ScaleX, target.ScaleY);

            m_pOuterClipper.ContentSize = CCAffineTransform.Transform(target.ContentSize, tranform);
            m_pOuterClipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            m_pOuterClipper.RunAction(new CCRepeatForever(new CCRotateBy(1, 45)));

            m_pOuterClipper.Stencil = target;

            CCClippingNode holesClipper = new CCClippingNode();

            holesClipper.Inverted       = true;
            holesClipper.AlphaThreshold = 0.05f;

            holesClipper.AddChild(target);

            m_pHoles = new CCNode(m_pOuterClipper.ContentSize);

            holesClipper.AddChild(m_pHoles);

            m_pHolesStencil = new CCNode(m_pOuterClipper.ContentSize);

            holesClipper.Stencil = m_pHolesStencil;

            m_pOuterClipper.AddChild(holesClipper);

            this.AddChild(m_pOuterClipper);

            var listener = new CCEventListenerTouchAllAtOnce();

            listener.OnTouchesBegan = onTouchesBegan;

            AddEventListener(listener);
        }
Example #9
0
        public override void Setup()
        {
            CCSize windowSize = VisibleBoundsWorldspace.Size;

            stencil          = Stencil();
            stencil.Tag      = kTagStencilNode;
            stencil.Position = windowSize.Center;

            CCClippingNode clipper = Clipper();

            clipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            clipper.Stencil     = stencil;
            AddChild(clipper);

            content          = Content();
            content.Tag      = kTagContentNode;
            content.Position = new CCPoint(50, 50);
            clipper.AddChild(content);
        }
Example #10
0
        public override void Setup()
        {
            CCSprite target = new CCSprite(TestResource.s_pPathBlock);

            target.AnchorPoint = CCPoint.Zero;
            target.Scale       = 3;

            m_pOuterClipper = new CCClippingNode();
            CCAffineTransform tranform = CCAffineTransform.Identity;

            tranform = CCAffineTransform.Scale(tranform, target.Scale, target.Scale);

            m_pOuterClipper.ContentSize = CCAffineTransform.Transform(target.ContentSize, tranform);
            m_pOuterClipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            m_pOuterClipper.Position    = ContentSize.Center;
            m_pOuterClipper.RunAction(new CCRepeatForever(new CCRotateBy(1, 45)));

            m_pOuterClipper.Stencil = target;

            CCClippingNode holesClipper = new CCClippingNode();

            holesClipper.Inverted       = true;
            holesClipper.AlphaThreshold = 0.05f;

            holesClipper.AddChild(target);

            m_pHoles = new CCNode();

            holesClipper.AddChild(m_pHoles);

            m_pHolesStencil = new CCNode();

            holesClipper.Stencil = m_pHolesStencil;

            m_pOuterClipper.AddChild(holesClipper);

            this.AddChild(m_pOuterClipper);

            this.TouchEnabled = true;
        }
Example #11
0
        public override void Setup()
        {
            var s = CCDirector.SharedDirector.WinSize;

            CCClippingNode clipper = new CCClippingNode();

            clipper.Tag         = kTagClipperNode;
            clipper.ContentSize = new CCSize(200, 200);
            clipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            clipper.Position    = ContentSize.Center;
            clipper.RunAction(new CCRepeatForever(new CCRotateBy(1, 45)));
            AddChild(clipper);

            CCDrawNode stencil = new CCDrawNode();

            CCPoint[] rectangle =
            {
                new CCPoint(0,                                                  0),
                new CCPoint(clipper.ContentSize.Width,                          0),
                new CCPoint(clipper.ContentSize.Width, clipper.ContentSize.Height),
                new CCPoint(0,                         clipper.ContentSize.Height),
            };

            CCColor4F white = new CCColor4F(1, 1, 1, 1);

            stencil.DrawPolygon(rectangle, 4, white, 0, white);
            clipper.Stencil = stencil;

            CCSprite content = new CCSprite(TestResource.s_back2);

            content.Tag         = kTagContentNode;
            content.AnchorPoint = new CCPoint(0.5f, 0.5f);
            content.Position    = clipper.ContentSize.Center;
            clipper.AddChild(content);

            m_bScrolling = false;

            TouchEnabled = true;
        }
Example #12
0
        public override void Setup()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCNode stencil = Stencil();

            stencil.Tag      = kTagStencilNode;
            stencil.Position = new CCPoint(50, 50);

            CCClippingNode clipper = Clipper();

            clipper.Tag         = kTagClipperNode;
            clipper.AnchorPoint = new CCPoint(0.5f, 0.5f);
            clipper.Position    = new CCPoint(s.Width / 2 - 50, s.Height / 2 - 50);
            clipper.Stencil     = stencil;
            AddChild(clipper);

            CCNode content = Content();

            content.Position = new CCPoint(50, 50);
            clipper.AddChild(content);
        }