chiark / gitweb /
Patch idea from Debian, but modified considerably in implementation:
authorSimon Tatham <anakin@pobox.com>
Sun, 25 Apr 2010 14:57:20 +0000 (14:57 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 25 Apr 2010 14:57:20 +0000 (14:57 +0000)
introduce a new colour in Slant (COL_FILLEDSQUARE) which is used for
the background of any grid square that has a diagonal line in it.
This makes it easier to spot the one square on a giant board you
forgot to fill in, but on the other hand I found it to look very
strange and disconcerting. So I've set the colour to be identical to
COL_BACKGROUND by default, and users who like the idea can enable it
by environment variable or by local patch.

[originally from svn r8930]

misc.c
slant.c

diff --git a/misc.c b/misc.c
index 4215e477408f77c07ba8645c812fdea9184f62f3..fe413327e12c9791d9b86648a882ff73d94c1fa1 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -187,8 +187,10 @@ void game_mkhighlight_specific(frontend *fe, float *ret,
     }
 
     for (i = 0; i < 3; i++) {
-        ret[highlight * 3 + i] = ret[background * 3 + i] * 1.2F;
-        ret[lowlight * 3 + i] = ret[background * 3 + i] * 0.8F;
+       if (highlight >= 0)
+           ret[highlight * 3 + i] = ret[background * 3 + i] * 1.2F;
+       if (lowlight >= 0)
+           ret[lowlight * 3 + i] = ret[background * 3 + i] * 0.8F;
     }
 }
 
diff --git a/slant.c b/slant.c
index 88ed996f5ce690e318e6e858c13ad6f3e6552855..35cbd47850b37e2a57dee9b0bcd75216b786df86 100644 (file)
--- a/slant.c
+++ b/slant.c
@@ -39,7 +39,8 @@ enum {
     COL_SLANT1,
     COL_SLANT2,
     COL_ERROR,
-    COL_CURSOR, COL_LOWLIGHT, /* LOWLIGHT currently not used. */
+    COL_CURSOR,
+    COL_FILLEDSQUARE,
     NCOLOURS
 };
 
@@ -1809,8 +1810,12 @@ static float *game_colours(frontend *fe, int *ncolours)
 {
     float *ret = snewn(3 * NCOLOURS, float);
 
-    /* CURSOR colour is a background highlight. LOWLIGHT is unused. */
-    game_mkhighlight(fe, ret, COL_BACKGROUND, COL_CURSOR, COL_LOWLIGHT);
+    /* CURSOR colour is a background highlight. */
+    game_mkhighlight(fe, ret, COL_BACKGROUND, COL_CURSOR, -1);
+
+    ret[COL_FILLEDSQUARE * 3 + 0] = ret[COL_BACKGROUND * 3 + 0];
+    ret[COL_FILLEDSQUARE * 3 + 1] = ret[COL_BACKGROUND * 3 + 1];
+    ret[COL_FILLEDSQUARE * 3 + 2] = ret[COL_BACKGROUND * 3 + 2];
 
     ret[COL_GRID * 3 + 0] = ret[COL_BACKGROUND * 3 + 0] * 0.7F;
     ret[COL_GRID * 3 + 1] = ret[COL_BACKGROUND * 3 + 1] * 0.7F;
@@ -1889,7 +1894,9 @@ static void draw_tile(drawing *dr, game_drawstate *ds, game_clues *clues,
 
     draw_rect(dr, COORD(x), COORD(y), TILESIZE, TILESIZE,
              (v & FLASH) ? COL_GRID :
-              (v & CURSOR) ? COL_CURSOR : COL_BACKGROUND);
+              (v & CURSOR) ? COL_CURSOR :
+             (v & (BACKSLASH | FORWSLASH)) ? COL_FILLEDSQUARE :
+             COL_BACKGROUND);
 
     /*
      * Draw the grid lines.