spinnyman
This commit is contained in:
parent
abdf4f38d9
commit
2ea8f04f19
36
main.cpp
36
main.cpp
|
@ -18,8 +18,8 @@ int main() {
|
|||
curs_set(0);
|
||||
int pos_x = 1;
|
||||
int pos_y = 1;
|
||||
dir direction = dir::SW;
|
||||
mvaddch(pos_y, pos_x, '0' + direction);
|
||||
dir direction = dir::SE;
|
||||
mvaddch(pos_y, pos_x, 'O');
|
||||
int ch;
|
||||
while ((ch = wgetch(stdscr)) != 'q') {
|
||||
int rotd = 0;
|
||||
|
@ -37,6 +37,9 @@ int main() {
|
|||
case KEY_UP:
|
||||
movval = 1;
|
||||
break;
|
||||
case 'c':
|
||||
pos_y = LINES / 2;
|
||||
pos_x = COLS / 2;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
@ -73,10 +76,33 @@ int main() {
|
|||
default:
|
||||
break;
|
||||
};
|
||||
pos_x = pos_x % COLS;
|
||||
pos_y = pos_y % LINES;
|
||||
clear();
|
||||
mvaddch(pos_y, pos_x, 'O');
|
||||
switch(direction) {
|
||||
case dir::N:
|
||||
case dir::S:
|
||||
mvaddch(pos_y, pos_x-1, '-');
|
||||
mvaddch(pos_y, pos_x+1, '-');
|
||||
break;
|
||||
case dir::E:
|
||||
case dir::W:
|
||||
mvaddch(pos_y-1, pos_x, '|');
|
||||
mvaddch(pos_y+1, pos_x, '|');
|
||||
break;
|
||||
case dir::NE:
|
||||
case dir::SW:
|
||||
mvaddch(pos_y-1, pos_x-1, '\\');
|
||||
mvaddch(pos_y+1, pos_x+1, '\\');
|
||||
break;
|
||||
case dir::NW:
|
||||
case dir::SE:
|
||||
mvaddch(pos_y+1, pos_x-1, '/');
|
||||
mvaddch(pos_y-1, pos_x+1, '/');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
refresh();
|
||||
mvaddch(pos_y, pos_x, '0' + direction);
|
||||
}
|
||||
endwin();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue