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
        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 #3
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 #4
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 #5
0
        private void pokeHoleAtPoint(CCPoint point)
        {
            float scale    = CCRandom.Float_0_1() * 0.2f + 0.9f;
            float rotation = CCRandom.Float_0_1() * 360f;

            CCSprite hole = new CCSprite("Images/hole_effect.png");

            hole.Position = point;
            hole.Rotation = rotation;
            hole.Scale    = scale;

            m_pHoles.AddChild(hole);

            CCSprite holeStencil = new CCSprite("Images/hole_stencil.png");

            holeStencil.Position = point;
            holeStencil.Rotation = rotation;
            holeStencil.Scale    = scale;

            m_pHolesStencil.AddChild(holeStencil);

            m_pOuterClipper.RunAction(new CCSequence(new CCScaleBy(0.05f, 0.95f), new CCScaleTo(0.125f, 1)));
        }