public static DialogResult Show() { pauseForm = new PauseForm(); pauseForm.ShowDialog(); return(buttonResult); }
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) { gameTimer.Enabled = false; rightArrowDown = leftArrowDown = upArrowDown = downArrowDown = false; DialogResult result = PauseForm.Show(); if (result == DialogResult.Cancel) { gameTimer.Enabled = true; } else if (result == DialogResult.Abort) { MainForm.ChangeScreen(this, "MenuScreen"); } } //TODO - basic player 1 key down bools set below. Add remainging key down // required for player 1 or player 2 here. //player 1 button presses switch (e.KeyCode) { case Keys.Left: snakeDirection = "left"; break; case Keys.Down: snakeDirection = "down"; break; case Keys.Right: snakeDirection = "right"; break; case Keys.Up: snakeDirection = "up"; break; } }