public void ShowMenu() { Console.SetWindowSize(GameEngine.GameScreenWidth, GameEngine.GameScreenHeight); Console.SetBufferSize(GameEngine.GameScreenWidth, GameEngine.GameScreenHeight); RenderWindowIfNotAlreadyOpened(_menuWindow); int keyCode; do { keyCode = Console.ReadKey(true).Key.GetHashCode(); } while (keyCode != 37 && keyCode != 39 && keyCode != 13); if (keyCode == 37) // left arrow { if (_menuWindow.GetCurrentButtonActive() > 0) { _menuWindow.SetButtonActive(_menuWindow.GetCurrentButtonActive() - 1); _menuWindow.RenderButtons(); } ShowMenu(); } else if (keyCode == 39) // right arrow { if (_menuWindow.GetCurrentButtonActive() < _menuWindow.ButtonCount - 1) { _menuWindow.SetButtonActive(_menuWindow.GetCurrentButtonActive() + 1); _menuWindow.RenderButtons(); } ShowMenu(); } else if (keyCode == 13) // enter { _menuWindow.IsAlreadyOpen = false; switch (_menuWindow.GetCurrentButtonActive()) { case 0: ShowCredits(); break; case 1: ShowHighScore(); break; case 2: // start game GameEngine.StartGame(); break; case 3: // enable/disable sound SoundManager.EnableOrDisableMusic(); _menuWindow.IsAlreadyOpen = true; ShowMenu(); break; case 4: ShowExitWindow(); break; } } }