Exemplo n.º 1
0
        private void GameScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            // opens a pause screen is escape is pressed. Depending on what is pressed
            // on pause screen the program will either continue or exit to main menu
            if (e.KeyCode == Keys.Escape)
            {
                gameTimer.Enabled = false;
                upArrowDown       = spaceDown = false;

                DialogResult result = PauseForm.Show();

                if (result == DialogResult.Cancel)
                {
                    gameTimer.Enabled = true;
                }
                if (result == DialogResult.Abort)
                {
                    Form1.changeScreen(this, "MenuScreen");
                }
            }

            //player 1 button presses
            switch (e.KeyCode)
            {
            case Keys.Up:
                upArrowDown = true;
                break;

            case Keys.Space:
                spaceDown = true;
                break;
            }
        }
Exemplo n.º 2
0
        public static DialogResult Show()
        {
            pauseForm = new PauseForm();

            pauseForm.ShowDialog();
            return(buttonResult);
        }