diff options
author | June McEnroe <june@causal.agency> | 2019-01-04 13:00:13 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-01-04 13:00:13 -0500 |
commit | dc13b266a2b208c1b40c488b8d14903ec779417c (patch) | |
tree | 517a592d7e3e903afafc420d6cf08466b9449bf6 | |
parent | Add indicator of current position in map (diff) | |
download | torus-dc13b266a2b208c1b40c488b8d14903ec779417c.tar.gz torus-dc13b266a2b208c1b40c488b8d14903ec779417c.zip |
Add simplified speed control
Diffstat (limited to '')
-rw-r--r-- | client.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/client.c b/client.c index 3647e60..9aa052a 100644 --- a/client.c +++ b/client.c @@ -282,10 +282,12 @@ static struct { ModeDraw, ModeLine, } mode; + int8_t delta; uint8_t color; uint8_t shift; uint8_t draw; } input = { + .delta = 1, .color = ColorWhite, }; @@ -380,10 +382,10 @@ static uint8_t inputCell(wchar_t ch) { static void inputNormal(bool keyCode, wchar_t ch) { if (keyCode) { switch (ch) { - break; case KEY_LEFT: clientMove(-1, 0); - break; case KEY_RIGHT: clientMove( 1, 0); - break; case KEY_UP: clientMove( 0, -1); - break; case KEY_DOWN: clientMove( 0, 1); + break; case KEY_LEFT: clientMove(-input.delta, 0); + break; case KEY_RIGHT: clientMove( input.delta, 0); + break; case KEY_UP: clientMove( 0, -input.delta); + break; case KEY_DOWN: clientMove( 0, input.delta); break; case KEY_F(1): input.shift = 0x00; break; case KEY_F(2): input.shift = 0xC0; @@ -400,14 +402,16 @@ static void inputNormal(bool keyCode, wchar_t ch) { break; case Esc: modeNormal(); input.shift = 0; break; case 'q': endwin(); exit(EX_OK); - break; case 'h': clientMove(-1, 0); - break; case 'l': clientMove( 1, 0); - break; case 'k': clientMove( 0, -1); - break; case 'j': clientMove( 0, 1); - 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 '\\': input.delta = (input.delta == 1 ? 4 : 1); + + break; case 'h': clientMove(-input.delta, 0); + break; case 'l': clientMove( input.delta, 0); + break; case 'k': clientMove( 0, -input.delta); + break; case 'j': clientMove( 0, input.delta); + break; case 'y': clientMove(-input.delta, -input.delta); + break; case 'u': clientMove( input.delta, -input.delta); + break; case 'b': clientMove(-input.delta, input.delta); + break; case 'n': clientMove( input.delta, input.delta); break; case '0': colorFg(ColorBlack); break; case '1': colorFg(ColorRed); |