From 96038fbcb01261dfc4b786562b1ddb702c991483 Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 18 Nov 2015 21:24:43 -0600 Subject: map successfully imports, need to do coloring next --- inc/Frame.hpp | 4 +++- src/Frame.cpp | 19 +++++++++++-------- src/Screen.cpp | 3 +++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/inc/Frame.hpp b/inc/Frame.hpp index 0bfce2c..ad9ef99 100644 --- a/inc/Frame.hpp +++ b/inc/Frame.hpp @@ -6,6 +6,7 @@ #include #include #include +#include using namespace std; @@ -35,9 +36,10 @@ class Frame int height, width; int row, col; bool hasSuper; + bool colored = false; WINDOW * w; WINDOW * super; - string m; + vector m; }; #endif diff --git a/src/Frame.cpp b/src/Frame.cpp index 274ad20..7da219c 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -25,11 +25,11 @@ Frame::Frame(string location, int nRow, int nCol) if(file.is_open()) { getline(file,line); - m.append(line); + m.push_back(line); i=line.length(); while(getline(file,line)) { - m.append(line); + m.push_back(line); j++; } } @@ -135,12 +135,15 @@ void Frame::move(int nRow, int nCol) } void Frame::fillWindow() -{ - for(int i = 0; i < width;i++ ) - for(int j = 0; j < height;j++) - mvwaddch(w,j,i,'.'); - - +{ + if(!colored) + for(int i = 0; i < width; i++) + for(int j = 0; j < height; j++) + { + attron(COLOR_PAIR(1)); + mvwaddch(w,j,i,m[j][i]); + } + for(int y = 0; y < height; ++y) { mvwaddch(w, y, 0, '-'); diff --git a/src/Screen.cpp b/src/Screen.cpp index c3977d6..40a31d1 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -9,6 +9,9 @@ Screen::Screen() keypad(stdscr,TRUE); curs_set(0); getmaxyx(stdscr,height,width); + + start_color(); + init_pair(1, COLOR_GREEN, COLOR_RED); } Screen::~Screen() -- cgit v1.2.3