Example #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = VisibleBoundsWorldspace.Size;

            var textField = new CCTextField("[click here for input]",
                                            "fonts/MarkerFelt",
                                            22,
                                            CCLabelFormat.SpriteFont);

            textField.BeginEditing += OnBeginEditing;
            textField.EndEditing   += OnEndEditing;
            textField.Position      = s.Center;

            textField.AutoEdit = true;

            AddChild(textField);

            TrackNode  = textField;
            scrollUp   = new CCMoveTo(0.5f, VisibleBoundsWorldspace.Top() - new CCPoint(0, s.Height / 4));
            scrollDown = new CCMoveTo(0.5f, textField.Position);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            var origin = Layer.VisibleBoundsWorldspace.Size;

            var label1 = new CCLabel(string.Empty, "debuguncompressed", 0, CCLabelFormat.SpriteFont);

            var texture = label1.TextureAtlas != null ? label1.TextureAtlas.Texture : null;

            if (texture != null)
            {
                spriteFontNode       = new CCSprite(texture);
                spriteFontNode.Scale = 2;
            }
            else
            {
                spriteFontNode = new CCLabel("Texture can not be loaded", "arial", 24, CCLabelFormat.SpriteFont);
            }
            //spriteFontNode.Color = CCColor3B.Magenta;
            spriteFontNode.Position = origin.Center;


            AddChild(spriteFontNode);

            var itemUncompressed = new CCMenuItemLabel(new CCLabel("Uncompressed", "fonts/arial", 24, CCLabelFormat.SpriteFont));
            var itemCompressed   = new CCMenuItemLabel(new CCLabel("Compressed", "fonts/arial", 24, CCLabelFormat.SpriteFont));

            itemUncompressed.AnchorPoint = CCPoint.AnchorMiddleLeft;
            itemCompressed.AnchorPoint   = CCPoint.AnchorMiddleLeft;
            var mi1  = new CCMenuItemToggle(OnToggle, itemUncompressed, itemCompressed);
            var menu = new CCMenu(mi1);

            AddChild(menu);
            menu.Position = VisibleBoundsWorldspace.Left();
        }
        public override void OnEnter()
        {
            base.OnEnter();

            var move      = new CCMoveBy(3, new CCPoint(VisibleBoundsWorldspace.Right().X - 130, 0));
            var move_back = move.Reverse();

            var move_ease_in      = new CCEaseSineIn(move);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out      = new CCEaseSineOut(move);
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime(0.25f);

            var seq1 = new CCSequence(move, delay, move_back, delay);
            var seq2 = new CCSequence(move_ease_in, delay, move_ease_in_back, delay);
            var seq3 = new CCSequence(move_ease_out, delay, move_ease_out_back,
                                      delay);

            m_grossini.RepeatForever(seq1);
            m_tamara.RepeatForever(seq2);
            m_kathia.RepeatForever(seq3);
        }
Example #4
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            title.Position = VisibleBoundsWorldspace.Top() + new CCPoint(0, -40);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize windowSize = VisibleBoundsWorldspace.Size;

            var move = new CCMoveBy(4, new CCPoint(windowSize.Width / 2, 0));

            backGround.Position   = VisibleBoundsWorldspace.Left();
            backGround.PositionX += windowSize.Width / 4;

            // Run background animation
            backGround.RepeatForever(move, move.Reverse());

            backGround.DrawSolidCircle(CCPoint.Zero, 220, CCColor4B.White);
            AddChild(backGround);


            var color = CCColor4B.Red;
            var alpha = (byte)(255 * 0.3f);

            color.A = alpha;

            // Draw polygons
            //P1: 380:-160 P2: 200:-240 P3: 160:-420
            CCPoint[] points = new CCPoint[]
            {
                //P1: 380:-160 P2: 200:-240 P3: 160:-420
                new CCPoint(380, -160),
                new CCPoint(200, -240),
                new CCPoint(160, -420),
            };

            DrawSolidPolygon(points, color);

            //P1: 160:-420 P2: 200:-520 P3: 360:-540
            points[0] = new CCPoint(160, -420);
            points[1] = new CCPoint(200, -520);
            points[2] = new CCPoint(360, -540);

            DrawSolidPolygon(points, color);

            //P1: 360:-540 P2: 420:-600 P3: 520:-520
            points[0] = new CCPoint(360, -540);
            points[1] = new CCPoint(420, -600);
            points[2] = new CCPoint(530, -520);

            DrawSolidPolygon(points, color);

            //P1: 520:-520 P2: 380:-160 P3: 160:-420
            points[0] = new CCPoint(520, -520);
            points[1] = new CCPoint(380, -160);
            points[2] = new CCPoint(160, -420);

            DrawSolidPolygon(points, color);

            // P1: 160:-420 P2: 360:-540 P3: 520:-520
            points[0] = new CCPoint(160, -420);
            points[1] = new CCPoint(360, -540);
            points[2] = new CCPoint(520, -520);

            DrawSolidPolygon(points, color);

            drawTriangles.Position = windowSize.Center;
            // Offset by the bounds of the polygons to more or less center it
            drawTriangles.PositionX -= 370;
            drawTriangles.PositionY += 440;
        }