Use wasd as control keys
This commit is contained in:
parent
63eacc6223
commit
e5101d5e34
2
README
2
README
@ -1,4 +1,4 @@
|
|||||||
My own toy implementation of 2048 on the command line.
|
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
8
main.c
@ -56,16 +56,16 @@ void game_loop(board *b) {
|
|||||||
printf("Make a move:\n");
|
printf("Make a move:\n");
|
||||||
fgets(c, sizeof(c), stdin);
|
fgets(c, sizeof(c), stdin);
|
||||||
switch(c[0]) {
|
switch(c[0]) {
|
||||||
case 'h':
|
case 'a':
|
||||||
d = west;
|
d = west;
|
||||||
break;
|
break;
|
||||||
case 'j':
|
case 's':
|
||||||
d = south;
|
d = south;
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'w':
|
||||||
d = north;
|
d = north;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'd':
|
||||||
d = east;
|
d = east;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user