Exemplo n.º 1
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;
        }