diff options
| author | Simon Tatham <anakin@pobox.com> | 2009-06-21 13:24:48 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2009-06-21 13:24:48 +0000 |
| commit | 4ecc4f92d8c385e5bfed23c99018571a28c9711b (patch) | |
| tree | 99cb169f785c7fb350ca379e4299662e45cd61d8 /loopy.c | |
| parent | 0687980f0c3204d283848ba41761a7724e4a6168 (diff) | |
| download | puzzles-4ecc4f92d8c385e5bfed23c99018571a28c9711b.zip puzzles-4ecc4f92d8c385e5bfed23c99018571a28c9711b.tar.gz puzzles-4ecc4f92d8c385e5bfed23c99018571a28c9711b.tar.bz2 puzzles-4ecc4f92d8c385e5bfed23c99018571a28c9711b.tar.xz | |
Patch from Mark Wooding (though somewhat tampered with by me): have
Loopy mark LINE_NO grid edges with very faint lines, instead of
leaving them totally undrawn. Helps in complex grid types where the
line layout isn't entirely obvious to a player not already familiar
with it. Disableable by setting LOOPY_FAINT_LINES=n in the
environment, just in case anyone turns out to seriously dislike it.
(You could probably disable it via LOOPY_COLOUR_6 too, but you'd
have to know the exact shade of your background to get that right.)
[originally from svn r8597]
Diffstat (limited to 'loopy.c')
| -rw-r--r-- | loopy.c | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -102,6 +102,7 @@ enum { COL_HIGHLIGHT, COL_MISTAKE, COL_SATISFIED, + COL_FAINT, NCOLOURS }; @@ -844,6 +845,14 @@ static float *game_colours(frontend *fe, int *ncolours) ret[COL_SATISFIED * 3 + 1] = 0.0F; ret[COL_SATISFIED * 3 + 2] = 0.0F; + /* We want the faint lines to be a bit darker than the background. + * Except if the background is pretty dark already; then it ought to be a + * bit lighter. Oy vey. + */ + ret[COL_FAINT * 3 + 0] = ret[COL_BACKGROUND * 3 + 0] * 0.9F; + ret[COL_FAINT * 3 + 1] = ret[COL_BACKGROUND * 3 + 1] * 0.9F; + ret[COL_FAINT * 3 + 2] = ret[COL_BACKGROUND * 3 + 2] * 0.9F; + *ncolours = NCOLOURS; return ret; } @@ -3467,7 +3476,7 @@ static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate, else if (state->lines[i] == LINE_UNKNOWN) line_colour = COL_LINEUNKNOWN; else if (state->lines[i] == LINE_NO) - line_colour = COL_BACKGROUND; + line_colour = COL_FAINT; else if (ds->flashing) line_colour = COL_HIGHLIGHT; else @@ -3482,7 +3491,16 @@ static void game_redraw(drawing *dr, game_drawstate *ds, game_state *oldstate, ymin = min(y1, y2); ymax = max(y1, y2); - if (line_colour != COL_BACKGROUND) { + if (line_colour == COL_FAINT) { + static int draw_faint_lines = -1; + if (draw_faint_lines < 0) { + char *env = getenv("LOOPY_FAINT_LINES"); + draw_faint_lines = (!env || (env[0] == 'y' || + env[0] == 'Y')); + } + if (draw_faint_lines) + draw_line(dr, x1, y1, x2, y2, line_colour); + } else { /* (dx, dy) points roughly from (x1, y1) to (x2, y2). * The line is then "fattened" in a (roughly) perpendicular * direction to create a thin rectangle. */ |