diff options
author | tom <tom@ground-control> | 2015-11-19 17:38:17 -0600 |
---|---|---|
committer | tom <tom@ground-control> | 2015-11-19 17:38:17 -0600 |
commit | b4bf156884f71bec9fa526e80e1d1db43e7650b2 (patch) | |
tree | 0970f27373408474cf7979c40e2ee4574fb38e3d /src | |
parent | ba71810fab85da23ec8501af6d5d4935458b595e (diff) |
line of guys now appears near middle of map
Diffstat (limited to 'src')
-rw-r--r-- | src/Character.cpp | 9 | ||||
-rw-r--r-- | src/List.cpp | 16 | ||||
-rw-r--r-- | src/Screen.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 10 |
4 files changed, 32 insertions, 5 deletions
diff --git a/src/Character.cpp b/src/Character.cpp index 71a47bb..7f12035 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -1,10 +1,11 @@ #include "Character.hpp" -Character::Character(char nSymbol, int nRow, int nCol) +Character::Character(char nSymbol, int nColor, int nRow, int nCol) { symbol = nSymbol; row = nRow; col = nCol; + color = nColor; } void Character::move(int nRow, int nCol) @@ -13,6 +14,12 @@ void Character::move(int nRow, int nCol) col = nCol; } +void Character::draw(WINDOW * w) +{ + wattron(w,COLOR_PAIR(color)); + mvwaddch(w,row,col,symbol); +} + int Character::getRow() { return row; diff --git a/src/List.cpp b/src/List.cpp new file mode 100644 index 0000000..ce206c5 --- /dev/null +++ b/src/List.cpp @@ -0,0 +1,16 @@ +#include "List.hpp" + +List::List() +{ + for(int i = 0; i < 10; i++) + { + Character x ('@',3,150,150+i); + men.push_back(x); + } +} + +void List::draw(WINDOW * w) +{ + for(int i = 0; i < 10; i++) + men[i].draw(w); +} diff --git a/src/Screen.cpp b/src/Screen.cpp index 54033f7..ebaae4e 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -13,7 +13,7 @@ Screen::Screen() start_color(); init_pair(1, COLOR_GREEN, COLOR_BLACK); init_pair(2, COLOR_YELLOW,COLOR_BLACK); - init_pair(3, COLOR_WHITE, COLOR_WHITE); + init_pair(3, COLOR_WHITE, COLOR_BLUE); } Screen::~Screen() diff --git a/src/main.cpp b/src/main.cpp index 5c550de..baba44a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,12 +6,14 @@ int main() Frame map("scripts/map.txt",0,0); Frame view(map,s.getHeight(),s.getWidth(),0,0); + List L; - Character cursor('X',map.getHeight()/2,map.getWidth()/2); + Character cursor('X',3,map.getHeight()/2,map.getWidth()/2); map.fillWindow(); - map.add(cursor); - view.center(cursor); + cursor.draw(map.getWin()); + //view.center(cursor); + L.draw(map.getWin()); view.refresh(); while(true) @@ -32,6 +34,8 @@ int main() view.center(cursor); view.refresh(); map.fillWindow(); + cursor.draw(map.getWin()); + L.draw(map.getWin()); } return 0; |