/* ------------------------- box.c ----------------------------------- *
 *  Include-File zum Zeichnen von Rahmen auf der JOYCE unter C.        *
 *                                                                     *
 *  Enthaltene Funktionen:                                             *
 *                                                                     *
 *     void drawBox         -> Zeichnen eines Rahmens                  *
 * ------------------------------------------------------------------- */

#include <stdio.h>
#include "input2.h"

// Draws a box at position (x, y) with width w and height h.
// x and y are zero-based, i.e. the upper left corner is x = 0, y = 0.
void drawBox(int x, int y, int w, int h) {
  int i;

  gotoXY(x, y);
  putchar(150);
  for (i = 1; i < w - 1; i++) {
      putchar(154);
  }
  putchar(156);
  for (i = y + 1; i < y + h - 1; i++) {
    gotoXY(x, i);         putchar(149);
    gotoXY(x + w - 1, i); putchar(149);
  }
  gotoXY(x, y + h - 1);
  putchar(147);
  for (i = 1; i < w - 1; i++) {
      putchar(154);
  }
  putchar(153);
}
