drawMetadata function

void drawMetadata(
  1. int height,
  2. double speed,
  3. List<Direction> inputQueue,
  4. int score,
  5. bool isPaused,
)

Implementation

void drawMetadata(int height, double speed, List<Direction> inputQueue,
    int score, bool isPaused) {
  moveCursor(Point(0, height));
  clearLine(height);
  stdout.write('q: quit, p: pause, w,s,a,d: move, +,-: speed');
  moveCursor(Point(0, height + 1));
  clearLine(height + 1);
  stdout.write('speed: ${speed.toStringAsFixed(2)} units/sec');
  moveCursor(Point(0, height + 2));
  clearLine(height + 2);
  stdout.writeln(
      'move queue: {${inputQueue.map((e) => e.toString().replaceAll("Direction.", "")).join(", ")}}');
  moveCursor(Point(0, height + 3));
  clearLine(height + 3);
  stdout.write('score: ${score}');

  moveCursor(Point(0, height + 4));
  clearLine(height + 4);
  if (isPaused) {
    stdout.write('Paused');
  } else {
    stdout.write('Playing');
  }
}