static void Main(string[] args) { Console.SetWindowSize(Game.boardW, Game.boardH); Console.SetBufferSize(Game.boardW, Game.boardH); Console.CursorVisible = false; Menu menu = new Menu(); menu.Process(); }
public void Process() { while (Switch) { ConsoleKeyInfo btn = Console.ReadKey(true); if (mode == Mode.menu) { switch (btn.Key) { case ConsoleKey.UpArrow: case ConsoleKey.DownArrow: menu.Process(btn); break; case ConsoleKey.Enter: switch (menumode) { case MenuMode.main: MenuAction(); break; case MenuMode.options: OptionsAction(); break; case MenuMode.colors: ColorsAction(); break; } break; } } else { switch (btn.Key) { case ConsoleKey.UpArrow: case ConsoleKey.DownArrow: case ConsoleKey.LeftArrow: case ConsoleKey.RightArrow: game.Process(btn); break; case ConsoleKey.Tab: game.Save(); break; } } Thread.Sleep(speed); } }
public void Process(ConsoleKeyInfo pressedButton) { switch (pressedButton.Key) { case ConsoleKey.UpArrow: worm.DX = 0; worm.DY = -1; break; case ConsoleKey.DownArrow: worm.DX = 0; worm.DY = 1; break; case ConsoleKey.LeftArrow: worm.DX = -1; worm.DY = 0; break; case ConsoleKey.RightArrow: worm.DX = 1; worm.DY = 0; break; case ConsoleKey.Escape: Console.Clear(); t.Abort(); Menu menu = new Menu(); menu.Process(); break; } }