diff options
author | June McEnroe <programble@gmail.com> | 2017-07-31 00:32:04 -0400 |
---|---|---|
committer | June McEnroe <programble@gmail.com> | 2017-07-31 00:32:04 -0400 |
commit | bd8982220fdb6685f28b8af1e6a53a4b638be8a0 (patch) | |
tree | 394c0d019489184062546f579831b7a994b168a5 | |
parent | Handle large moves (diff) | |
download | torus-bd8982220fdb6685f28b8af1e6a53a4b638be8a0.tar.gz torus-bd8982220fdb6685f28b8af1e6a53a4b638be8a0.zip |
Adjust move speed in client
Diffstat (limited to '')
-rwxr-xr-x | client.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/client.c b/client.c index 1e2ea69..72c21c9 100755 --- a/client.c +++ b/client.c @@ -104,6 +104,8 @@ static void swapCell(int8_t dx, int8_t dy) { clientPut(aColor, aCell); } +static int8_t moveSpeed = 1; + static void readInput(void) { int c = getch(); @@ -168,14 +170,17 @@ static void readInput(void) { case 'x': clientPut(CH_COLOR(inch()), ' '); break; case '~': clientPut(inputColor, inch() & 0x7F); clientMove(1, 0); break; - case 'h': clientMove(-1, 0); break; - case 'j': clientMove( 0, 1); break; - case 'k': clientMove( 0, -1); break; - case 'l': clientMove( 1, 0); break; - case 'y': clientMove(-1, -1); break; - case 'u': clientMove( 1, -1); break; - case 'b': clientMove(-1, 1); break; - case 'n': clientMove( 1, 1); break; + case '[': if (moveSpeed > 1) moveSpeed--; break; + case ']': if (moveSpeed < 4) moveSpeed++; break; + + case 'h': clientMove(-moveSpeed, 0); break; + case 'j': clientMove( 0, moveSpeed); break; + case 'k': clientMove( 0, -moveSpeed); break; + case 'l': clientMove( moveSpeed, 0); break; + case 'y': clientMove(-moveSpeed, -moveSpeed); break; + case 'u': clientMove( moveSpeed, -moveSpeed); break; + case 'b': clientMove(-moveSpeed, moveSpeed); break; + case 'n': clientMove( moveSpeed, moveSpeed); break; case 'H': swapCell(-1, 0); break; case 'J': swapCell( 0, 1); break; |