Ejemplo n.º 1
0
        /// <summary>
        ///  Creates all WPF controls of the window
        /// </summary>
        private void InitializeComponents()
        {
            this.Height     = SystemMetrics.ScreenHeight;
            this.Width      = SystemMetrics.ScreenWidth;
            this.Background = new SolidColorBrush(Color.Black);

            // Tetris grid
            universeView = new UniverseView(gameUniverse);

            // Stack panel with next block and score
            GradientStackPanel statusStack = new GradientStackPanel(Orientation.Vertical, Color.Black, Color.White);

            statusStack.Width  = this.Width - universeView.Width;
            statusStack.Height = this.Height;

            // Next block control
            NextBlockView nextBlockView = new NextBlockView(gameUniverse);

            nextBlockView.SetMargin(8);
            nextBlockView.HorizontalAlignment = HorizontalAlignment.Right;

            // Score panel
            StatisticsPanel statsPanel = new StatisticsPanel(gameUniverse.Statistics);

            statsPanel.SetMargin(8);
            statsPanel.HorizontalAlignment = HorizontalAlignment.Right;

            statusStack.Children.Add(nextBlockView);
            statusStack.Children.Add(statsPanel);

            // Main stack on the screeen
            StackPanel mainStack = new StackPanel(Orientation.Horizontal);

            mainStack.Children.Add(universeView);
            mainStack.Children.Add(statusStack);
            this.Child = mainStack;

            // Set the window visibility to visible.
            this.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Creates all WPF controls of the window
        /// </summary>
        private void InitializeComponents()
        {
            this.Height = SystemMetrics.ScreenHeight;
            this.Width = SystemMetrics.ScreenWidth;
            this.Background = new SolidColorBrush(Color.Black);

            // Tetris grid
            universeView = new UniverseView(gameUniverse);

            // Stack panel with next block and score
            GradientStackPanel statusStack = new GradientStackPanel(Orientation.Vertical, Color.Black, Color.White);
            statusStack.Width = this.Width - universeView.Width;
            statusStack.Height = this.Height;

            // Next block control
            NextBlockView nextBlockView = new NextBlockView(gameUniverse);
            nextBlockView.SetMargin(8);
            nextBlockView.HorizontalAlignment = HorizontalAlignment.Right;

            // Score panel
            StatisticsPanel statsPanel = new StatisticsPanel(gameUniverse.Statistics);
            statsPanel.SetMargin(8);
            statsPanel.HorizontalAlignment = HorizontalAlignment.Right;

            statusStack.Children.Add(nextBlockView);
            statusStack.Children.Add(statsPanel);

            // Main stack on the screeen
            StackPanel mainStack = new StackPanel(Orientation.Horizontal);
            mainStack.Children.Add(universeView);
            mainStack.Children.Add(statusStack);
            this.Child = mainStack;

            // Set the window visibility to visible.
            this.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(this);
        }