Use wasd as control keys

master
Elias Fleckenstein 2021-06-07 12:21:59 +02:00
parent 63eacc6223
commit e5101d5e34
2 changed files with 5 additions and 5 deletions

2
README
View File

@ -1,4 +1,4 @@
My own toy implementation of 2048 on the command line.
It supports hjkl for movements and q for quit.
It supports wasd for movements and q for quit.

8
main.c
View File

@ -56,16 +56,16 @@ void game_loop(board *b) {
printf("Make a move:\n");
fgets(c, sizeof(c), stdin);
switch(c[0]) {
case 'h':
case 'a':
d = west;
break;
case 'j':
case 's':
d = south;
break;
case 'k':
case 'w':
d = north;
break;
case 'l':
case 'd':
d = east;
break;
case 'q':