Esempio n. 1
0
        public virtual void Update(GameTime gameTime, GameState gameState)
        {
            var cap = GamePad.GetCapabilities(PlayerIndex.One);

            if (cap.IsConnected && cap.HasStartButton && GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed)
            {
                PongGame.ShowMainMenu();
            }
        }
Esempio n. 2
0
        public PongGui(IPongGame pongGame, ISettings settings)
        {
            _pongGame = pongGame;
            _settings = settings;
            Screen    = new Screen()
            {
                Content = new StackPanel()
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin = new Thickness(20, 100),
                    Items  =
                    {
                        new Button()
                        {
                            Name    = "main",
                            Content = "Main Menu",
                            Width   = 100
                        },
                        new CheckBox()
                        {
                            Name    = "Running",
                            Content = "Paused",
                        },
                        new CheckBox()
                        {
                            Name    = "Sound",
                            Content = "Sound",
                        },
                        new CheckBox()
                        {
                            Name    = "Debug",
                            Content = "Debug",
                        },
                    }
                },
            };
            var btn = Screen.FindControl <Button>("main");

            btn.Clicked += (sender, args) => pongGame.ShowMainMenu();
            btn.Style();
            runningCheckBox  = Screen.FindControl <CheckBox>("Running");
            soundCheckBox    = Screen.FindControl <CheckBox>("Sound");
            debugginCheckBox = Screen.FindControl <CheckBox>("Debug");

            debugginCheckBox.IsChecked = settings.IsDebugging;
            soundCheckBox.IsChecked    = settings.IsSoundOn;
            runningCheckBox.IsChecked  = settings.IsPaused;
        }