diff options
author | tom <tom@ground-control> | 2015-11-18 20:54:40 -0600 |
---|---|---|
committer | tom <tom@ground-control> | 2015-11-18 20:54:40 -0600 |
commit | 0fc9844e4e81f9f78886a75eb15e3cf17d6adc36 (patch) | |
tree | 000ccf5d0426d6ce4f470107fb9f2581394a328f /src | |
parent | a760b9339a98281a8a1072d03dbf41f08eb696a6 (diff) |
test works now
Diffstat (limited to 'src')
-rw-r--r-- | src/.Frame.cpp.swp | bin | 12288 -> 0 bytes | |||
-rw-r--r-- | src/Frame.cpp | 32 | ||||
-rw-r--r-- | src/main.cpp | 2 |
3 files changed, 14 insertions, 20 deletions
diff --git a/src/.Frame.cpp.swp b/src/.Frame.cpp.swp Binary files differdeleted file mode 100644 index 1e3e507..0000000 --- a/src/.Frame.cpp.swp +++ /dev/null diff --git a/src/Frame.cpp b/src/Frame.cpp index fa9adae..274ad20 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -24,13 +24,21 @@ Frame::Frame(string location, int nRow, int nCol) if(file.is_open()) { + getline(file,line); + m.append(line); + i=line.length(); while(getline(file,line)) { m.append(line); j++; } - i=line.length(); } + + w = newwin(j,i,nRow,nCol); + height = j; + width = i; + row = nRow; + col = nCol; } @@ -128,24 +136,10 @@ void Frame::move(int nRow, int nCol) void Frame::fillWindow() { - int maxX = width/2; - int maxY = height/2; - - for(int y = 0; y < maxY; ++y) - for(int x = 0; x < maxX; ++x) - mvwaddch(w, y, x, '0'); - - for(int y = 0; y < maxY; ++y) - for(int x = maxX; x < width; ++x) - mvwaddch(w, y, x, '1'); - - for(int y = maxY; y < height; ++y) - for(int x = 0; x < maxX; ++x) - mvwaddch(w, y, x, '2'); - - for(int y = maxY; y < height; ++y) - for(int x = maxX; x < width; ++x) - mvwaddch(w, y, x, '3'); + for(int i = 0; i < width;i++ ) + for(int j = 0; j < height;j++) + mvwaddch(w,j,i,'.'); + for(int y = 0; y < height; ++y) { diff --git a/src/main.cpp b/src/main.cpp index d6b26ea..9dc48a4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ int main() Screen s; //Frame map(2*s.getHeight(),2*s.getWidth(),0,0); - Frame map("../scripts/map",0,0); + Frame map("scripts/map.txt",0,0); Frame view(map,s.getHeight(),s.getWidth(),0,0); Character cursor('X',map.getHeight()/2,map.getWidth()/2); |