It was an x/y screwup!

This commit is contained in:
Petra 2020-09-23 21:37:40 +00:00
parent 3cbfc57ecc
commit abdf4f38d9
1 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ int main() {
curs_set(0);
int pos_x = 1;
int pos_y = 1;
dir direction = dir::E;
dir direction = dir::SW;
mvaddch(pos_y, pos_x, '0' + direction);
int ch;
while ((ch = wgetch(stdscr)) != 'q') {
@ -43,17 +43,17 @@ int main() {
direction = rotate(direction, rotd);
switch (direction) {
case dir::N:
pos_x -= movval;
break;
case dir::S:
pos_x += movval;
break;
case dir::W:
pos_y -= movval;
break;
case dir::E:
case dir::S:
pos_y += movval;
break;
case dir::W:
pos_x -= movval;
break;
case dir::E:
pos_x += movval;
break;
case dir::NE:
pos_x += movval;
pos_y -= movval;
@ -76,7 +76,7 @@ int main() {
pos_x = pos_x % COLS;
pos_y = pos_y % LINES;
refresh();
mvaddch(pos_x, pos_y, '0' + direction);
mvaddch(pos_y, pos_x, '0' + direction);
}
endwin();
}