From a760b9339a98281a8a1072d03dbf41f08eb696a6 Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 18 Nov 2015 19:59:47 -0600 Subject: shovelling --- src/main.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/main.cpp (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..d6b26ea --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,38 @@ +#include "main.hpp" + +int main() +{ + Screen s; + + //Frame map(2*s.getHeight(),2*s.getWidth(),0,0); + Frame map("../scripts/map",0,0); + Frame view(map,s.getHeight(),s.getWidth(),0,0); + + Character cursor('X',map.getHeight()/2,map.getWidth()/2); + + map.fillWindow(); + map.add(cursor); + view.center(cursor); + view.refresh(); + + while(true) + { + 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; + + view.center(cursor); + view.refresh(); + } + + return 0; +} -- cgit v1.2.3