handleInput function

void handleInput(
  1. int byte,
  2. List<Direction> inputQueue,
  3. bool isPaused
)

Implementation

void handleInput(int byte, List<Direction> inputQueue, bool isPaused) {
  switch (byte) {
    case 119: // w
      inputQueue.add(Direction.up);
      break;
    case 115: // s
      inputQueue.add(Direction.down);
      break;
    case 97: // a
      inputQueue.add(Direction.left);
      break;
    case 100: // d
      inputQueue.add(Direction.right);
      break;
    case 112: // p
      // pause() will be handled in main
      break;
    case 113: // q
      gameOver();
      break;
  }
}