Ejemplo n.º 1
0
        public override void OnEnter()
        {
            base.OnEnter();

            float x, y;

            CCSize size = Layer.VisibleBoundsWorldspace.Size;
            x = size.Width;
            y = size.Height;

            var offset = (CCPoint)size / 4.0f;

            var blue = new Background(new CCColor4B(0, 0, 255, 255));
            var red = new Background(new CCColor4B(255, 0, 0, 255));
            var green = new Background(new CCColor4B(0, 255, 0, 255));
            var white = new Background(new CCColor4B(255, 255, 255, 255));

            blue.Scale = 0.5f;
            blue.Position = offset;
            blue.AddChild(new SpriteLayer());

            red.Scale = 0.5f;
            red.Position = offset;
            red.PositionX += x / 2.0f;

            green.Scale = 0.5f;
            green.Position = size.Center;
            green.PositionX -= offset.X;
            green.PositionY += offset.Y;
            green.AddChild(new TestLayer());

            white.Scale = 0.5f;
            white.Position = size.Center + offset;
            //white.PositionX += x / 2.0f;
            //white.PositionY += y / 2.0f;

            AddChild(blue, -1);
            AddChild(white);
            AddChild(green);
            AddChild(red);

            blue.RunAction(rot);
            red.RunAction(rot);
            green.RunAction(rot);
            white.RunAction(rot);
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            base.OnEnter();

            float x, y;

            CCSize size = Layer.VisibleBoundsWorldspace.Size;
            x = size.Width;
            y = size.Height;

            var offset = new CCPoint(x/4, y/4);

            var blue = new Background(size, new CCColor4B(0, 0, 255, 255));
            var red = new Background(size, new CCColor4B(255, 0, 0, 255));
            var green = new Background(size, new CCColor4B(0, 255, 0, 255));
            var white = new Background(size, new CCColor4B(255, 255, 255, 255));

            blue.Scale = 0.5f;
            blue.Position = CCPoint.Zero + offset;
            blue.AddChild(new SpriteLayer());

            red.Scale = 0.5f;
            red.Position = new CCPoint(x / 2,0) + offset;

            green.Scale = 0.5f;
            green.Position = new CCPoint(0, y / 2) + offset;
            green.AddChild(new TestLayer());

            white.Scale = 0.5f;
            white.Position = new CCPoint(x / 2, y / 2) + offset;

            AddChild(blue);
            AddChild(white);
            AddChild(green);
            AddChild(red);

            blue.RunAction(rot);
            red.RunAction(rot);
            green.RunAction(rot);
            white.RunAction(rot);
        }