diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9dc48a4..5c550de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,35 +3,35 @@ int main() { Screen s; - - //Frame map(2*s.getHeight(),2*s.getWidth(),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); - - map.fillWindow(); + + map.fillWindow(); map.add(cursor); view.center(cursor); - view.refresh(); - + view.refresh(); + while(true) { - char c = getch(); + char c = getch(); + + if (c == 'h') + map.add(cursor,cursor.getRow(),cursor.getCol()-1); + else if (c == 'l') + map.add(cursor,cursor.getRow(),cursor.getCol()+1); + else if (c == 'k') + map.add(cursor,cursor.getRow()-1,cursor.getCol()); + else if (c == 'j') + map.add(cursor,cursor.getRow()+1,cursor.getCol()); + else if (c == 'q') + break; - if(c == 'h') - map.add(cursor,cursor.getRow(),cursor.getCol()-1); - else if(c == 'l') - map.add(cursor,cursor.getRow(),cursor.getCol()+1); - else if(c == 'k') - map.add(cursor,cursor.getRow()-1,cursor.getCol()); - else if(c == 'j') - map.add(cursor,cursor.getRow()+1,cursor.getCol()); - else if(c == 'q') - break; - view.center(cursor); view.refresh(); + map.fillWindow(); } return 0; |