From c39092529f84756fd70f63951aa964db36204d07 Mon Sep 17 00:00:00 2001
From: matthew <matthew@owens.tech>
Date: Sun, 5 Aug 2018 16:29:31 +0100
Subject: [PATCH] fixed error output not showing, moved error output to it's
 own window

---
 nogl/err.c  | 31 +++++++++++++++----------------
 nogl/main.c |  7 +++++++
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/nogl/err.c b/nogl/err.c
index cb5f0f8..930bed6 100644
--- a/nogl/err.c
+++ b/nogl/err.c
@@ -3,20 +3,24 @@
 #include <ncurses.h>
 #include "point.h"
 
-char* lpath = NULL;
-static const char lendchar = '+';
-static const char lchar = '-';
+static WINDOW *win = NULL;
+static char* lpath = NULL;
+
+#define ERR_X 0
+#define ERR_Y 0
+#define ERR_W 80
+#define ERR_H 3
 
 void err_output(const char *message)
 {
-	Point2i scrsize = point2i(0,0);
-
 	if(stdscr == NULL){	// ncurses not initilised
 		fprintf(stderr, message);
 	} else {
 		err_clear();
-		getmaxyx(stdscr, scrsize.y, scrsize.x);
-		mvprintw(5, 5, message);
+		win = newwin(ERR_H, ERR_W, ERR_Y, ERR_X);
+		wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
+		mvwprintw(win, 1, 2, message);
+		wrefresh(win);
 	}
 }
 
@@ -27,13 +31,8 @@ void err_enable_logging(const char* logpath)
 
 void err_clear()
 {
-	Point2i msgpos;
-	getmaxyx(stdscr, msgpos.y, msgpos.x);
-
-	mvaddch(msgpos.y, 0, lendchar);
-	mvaddch(msgpos.y, msgpos.x, lendchar);
-
-	for(int i = 1; i < msgpos.y; ++i){
-		mvaddch(msgpos.y, i, lchar);
-	}
+	wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+	wrefresh(win);
+	delwin(win);
+	win = NULL;
 }
diff --git a/nogl/main.c b/nogl/main.c
index fd2a7c1..25b6428 100644
--- a/nogl/main.c
+++ b/nogl/main.c
@@ -4,6 +4,7 @@
 #include "board.h"
 #include "point.h"
 #include "board_renderer.h"
+#include "err.h"
 #include <ncurses.h>
 
 static Board* board = NULL;
@@ -51,6 +52,12 @@ int main()
 		return -1;
 	}
 
+	boardRenderer_render();
+	getchar();
+	err_enable_logging("test");
+	//refresh();
+	getchar();
+	err_clear();
 	boardRenderer_render();
 	getchar();
 
-- 
2.20.1