chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9e1a7d8
)
Pattern: color multiple squares with Ctrl- or Shift-cursor keys.
author
Jonas Kölker
<jonaskoelker@yahoo.com>
Mon, 21 Sep 2015 15:33:02 +0000
(17:33 +0200)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 3 Oct 2015 15:58:24 +0000
(16:58 +0100)
pattern.c
patch
|
blob
|
history
puzzles.but
patch
|
blob
|
history
diff --git
a/pattern.c
b/pattern.c
index 0688f33e4272e6d7a7fdb144a7351c6fa1f428dc..10621d1f0d45bd462640ac66780f33ba202a0b76 100644
(file)
--- a/
pattern.c
+++ b/
pattern.c
@@
-1056,6
+1056,7
@@
static char *interpret_move(const game_state *state, game_ui *ui,
const game_drawstate *ds,
int x, int y, int button)
{
const game_drawstate *ds,
int x, int y, int button)
{
+ int control = button & MOD_CTRL, shift = button & MOD_SHFT;
button &= ~MOD_MASK;
x = FROMCOORD(state->w, x);
button &= ~MOD_MASK;
x = FROMCOORD(state->w, x);
@@
-1156,10
+1157,23
@@
static char *interpret_move(const game_state *state, game_ui *ui,
}
if (IS_CURSOR_MOVE(button)) {
}
if (IS_CURSOR_MOVE(button)) {
+ int x = ui->cur_x, y = ui->cur_y, newstate;
+ char buf[80];
move_cursor(button, &ui->cur_x, &ui->cur_y, state->w, state->h, 0);
ui->cur_visible = 1;
move_cursor(button, &ui->cur_x, &ui->cur_y, state->w, state->h, 0);
ui->cur_visible = 1;
- return "";
+ if (!control && !shift) return "";
+
+ newstate = control ? shift ? GRID_UNKNOWN : GRID_FULL : GRID_EMPTY;
+ if (state->grid[y * state->w + x] == newstate &&
+ state->grid[ui->cur_y * state->w + ui->cur_x] == newstate)
+ return "";
+
+ sprintf(buf, "%c%d,%d,%d,%d", control ? shift ? 'U' : 'F' : 'E',
+ min(x, ui->cur_x), min(y, ui->cur_y),
+ abs(x - ui->cur_x) + 1, abs(y - ui->cur_y) + 1);
+ return dupstr(buf);
}
}
+
if (IS_CURSOR_SELECT(button)) {
int currstate = state->grid[ui->cur_y * state->w + ui->cur_x];
int newstate;
if (IS_CURSOR_SELECT(button)) {
int currstate = state->grid[ui->cur_y * state->w + ui->cur_x];
int newstate;
diff --git
a/puzzles.but
b/puzzles.but
index 80727c603b6834a89408c63dab04f1f0b8334259..ef96ad18c6f982028589259bf8559e83cb56e2d1 100644
(file)
--- a/
puzzles.but
+++ b/
puzzles.but
@@
-897,6
+897,10
@@
You can also move around the grid with the cursor keys. Pressing the
return key will cycle the current cell through empty, then black, then
white, then empty, and the space bar does the same cycle in reverse.
return key will cycle the current cell through empty, then black, then
white, then empty, and the space bar does the same cycle in reverse.
+Moving the cursor while holding Control will colour the moved-over
+squares black. Holding Shift will colour the moved-over squares
+white, and holding both will colour them grey.
+
(All the actions described in \k{common-actions} are also available.)
\H{pattern-parameters} \I{parameters, for Pattern}Pattern parameters
(All the actions described in \k{common-actions} are also available.)
\H{pattern-parameters} \I{parameters, for Pattern}Pattern parameters