From 5d3145ca44d7966326136adc1bd2dec910b5a8d2 Mon Sep 17 00:00:00 2001 From: tom Date: Fri, 20 Nov 2015 14:48:49 -0600 Subject: fixed trailing cursor --- src/main.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index baba44a..1066d08 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,31 +11,28 @@ int main() Character cursor('X',3,map.getHeight()/2,map.getWidth()/2); map.fillWindow(); - cursor.draw(map.getWin()); - //view.center(cursor); L.draw(map.getWin()); - view.refresh(); - + cursor.draw(map.getWin()); + while(true) { char c = getch(); if (c == 'h') - map.add(cursor,cursor.getRow(),cursor.getCol()-1); + cursor.move(cursor.getRow(),cursor.getCol()-1); else if (c == 'l') - map.add(cursor,cursor.getRow(),cursor.getCol()+1); + cursor.move(cursor.getRow(),cursor.getCol()+1); else if (c == 'k') - map.add(cursor,cursor.getRow()-1,cursor.getCol()); + cursor.move(cursor.getRow()-1,cursor.getCol()); else if (c == 'j') - map.add(cursor,cursor.getRow()+1,cursor.getCol()); + cursor.move(cursor.getRow()+1,cursor.getCol()); else if (c == 'q') - break; + break; - view.center(cursor); - view.refresh(); map.fillWindow(); - cursor.draw(map.getWin()); L.draw(map.getWin()); + cursor.draw(map.getWin()); + view.center(cursor); } return 0; -- cgit v1.2.3