Ejemplo n.º 1
0
        private void CreateBottomHalf(Grid grid)
        {
            // useremo un StackLayout per organizzare i nostri pulsanti
            var stackLayout = new StackLayout();
            // i primo pulsante sposterà il cerchio a sinistra quando si fa clic
            var moveLeftButton = new Button
            {
                Text = "Move Circle Left"
            };

            moveLeftButton.Clicked += (sender, e) => gameScene.MoveCircleLeft();
            stackLayout.Children.Add(moveLeftButton);
            // il secondo pulsante sposterà il cerchio a destra quando si fa clic su
            var moveCircleRight = new Button
            {
                Text = "Sposta il cerchio a destra"
            };

            moveCircleRight.Clicked += (sender, e) => gameScene.MoveCircleRight();
            stackLayout.Children.Add(moveCircleRight);
            // il layout dello stack sarà nella metà inferiore (riga 1)
            grid.Children.Add(stackLayout, 0, 1);
        }
Ejemplo n.º 2
0
        void CreateBottomHalf(Grid grid)
        {
            // We'll use a StackLayout to organize our buttons
            var stackLayout = new StackLayout();

            // The first button will move the circle to the left when it is clicked:
            var moveLeftButton = new Button {
                Text = "Move Circle Left"
            };

            moveLeftButton.Clicked += (sender, e) => gameScene.MoveCircleLeft();
            stackLayout.Children.Add(moveLeftButton);

            // The second button will move the circle to the right when clicked:
            var moveCircleRight = new Button {
                Text = "Move Circle Right"
            };

            moveCircleRight.Clicked += (sender, e) => gameScene.MoveCircleRight();
            stackLayout.Children.Add(moveCircleRight);

            // The stack layout will be in the bottom half (row 1):
            grid.Children.Add(stackLayout, 0, 1);
        }