diff options
-rw-r--r-- | inc/Frame.hpp | 4 | ||||
-rw-r--r-- | src/Frame.cpp | 19 | ||||
-rw-r--r-- | 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 <string> #include <fstream> #include <iostream> +#include <vector> 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 <string> 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() |