chiark / gitweb /
Add more keyboard controls to Slant.
authorJonas Kölker <jonaskoelker@yahoo.com>
Mon, 21 Sep 2015 16:34:53 +0000 (18:34 +0200)
committerSimon Tatham <anakin@pobox.com>
Sat, 3 Oct 2015 15:59:04 +0000 (16:59 +0100)
puzzles.but
slant.c

index d0b51de6faf289fa4a9208cd420f0172eb176d93..65782af8145c8b4d252f15ab8c411cc48e78dd8b 100644 (file)
@@ -1709,7 +1709,10 @@ the game entirely with one button if you need to.)
 
 You can also use the cursor keys to move around the grid. Pressing the
 return or space keys will place a \cw{\\} or a \cw{/}, respectively,
-and will then cycle them as above.
+and will then cycle them as above.  You can also press \cw{/} or
+\cw{\\} to place a \cw{/} or \cw{\\}, respectively, independent of
+what is already in the cursor square.  Backspace removes any line from
+the cursor square.
 
 (All the actions described in \k{common-actions} are also available.)
 
diff --git a/slant.c b/slant.c
index 6210d01af17da5f52976f3eee9ccf221d3e8cd23..a7a37921c326aea7df14f77e8b2bc89db3eb610b 100644 (file)
--- a/slant.c
+++ b/slant.c
@@ -1719,6 +1719,11 @@ static char *interpret_move(const game_state *state, game_ui *ui,
         move_cursor(button, &ui->cur_x, &ui->cur_y, w, h, 0);
         ui->cur_visible = 1;
         return "";
+    } else if (button == '\\' || button == '\b' || button == '/') {
+       int x = ui->cur_x, y = ui->cur_y;
+       if (button == ("\\" "\b" "/")[state->soln[y*w + x] + 1]) return NULL;
+       sprintf(buf, "%c%d,%d", button == '\b' ? 'C' : button, x, y);
+       return dupstr(buf);
     }
 
     if (action != NONE) {