static void OnKeyDown(ConsoleKey key) { var action = key.ToKeyAction(); if (action == null) { switch (key) { case ConsoleKey.Subtract: PreviousLevel(); player.PositionF = currentLevel.SpawnPosition; break; case ConsoleKey.Add: NextLevel(); player.PositionF = currentLevel.SpawnPosition; break; case ConsoleKey.T: viewport.IsDarkTheme ^= true; break; case ConsoleKey.L: Console.WindowWidth += Console.WindowWidth == Console.BufferWidth ? -2 : 2; break; } } else { ++controlsPressed[action.Value]; HandleControls(); } }
static void OnKeyUp(ConsoleKey key) { var action = key.ToKeyAction(); if (action != null) { --controlsPressed[action.Value]; } }