aboutsummaryrefslogtreecommitdiff
path: root/twiddle.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2005-07-06 18:27:40 +0000
committerSimon Tatham <anakin@pobox.com>2005-07-06 18:27:40 +0000
commit753339737ea98fd9caf26a5913f8f210897ef04a (patch)
treef70ebcb86e31e818d9bd98123e31977d37c5aa89 /twiddle.c
parentd4001cbc0d7e858518849363531af9f15246a911 (diff)
downloadpuzzles-753339737ea98fd9caf26a5913f8f210897ef04a.zip
puzzles-753339737ea98fd9caf26a5913f8f210897ef04a.tar.gz
puzzles-753339737ea98fd9caf26a5913f8f210897ef04a.tar.bz2
puzzles-753339737ea98fd9caf26a5913f8f210897ef04a.tar.xz
Refactoring from James H: the highlight and lowlight colour setup
common to Fifteen, Sixteen, Twiddle and Pegs is now a utility function in misc.c. [originally from svn r6076]
Diffstat (limited to 'twiddle.c')
-rw-r--r--twiddle.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/twiddle.c b/twiddle.c
index ac6f385..3e9e74e 100644
--- a/twiddle.c
+++ b/twiddle.c
@@ -765,27 +765,11 @@ static float *game_colours(frontend *fe, game_state *state, int *ncolours)
{
float *ret = snewn(3 * NCOLOURS, float);
int i;
- float max;
- frontend_default_colour(fe, &ret[COL_BACKGROUND * 3]);
-
- /*
- * Drop the background colour so that the highlight is
- * noticeably brighter than it while still being under 1.
- */
- max = ret[COL_BACKGROUND*3];
- for (i = 1; i < 3; i++)
- if (ret[COL_BACKGROUND*3+i] > max)
- max = ret[COL_BACKGROUND*3+i];
- if (max * 1.2F > 1.0F) {
- for (i = 0; i < 3; i++)
- ret[COL_BACKGROUND*3+i] /= (max * 1.2F);
- }
+ game_mkhighlight(fe, ret, COL_BACKGROUND, COL_HIGHLIGHT, COL_LOWLIGHT);
for (i = 0; i < 3; i++) {
- ret[COL_HIGHLIGHT * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 1.2F;
ret[COL_HIGHLIGHT_GENTLE * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 1.1F;
- ret[COL_LOWLIGHT * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 0.8F;
ret[COL_LOWLIGHT_GENTLE * 3 + i] = ret[COL_BACKGROUND * 3 + i] * 0.9F;
ret[COL_TEXT * 3 + i] = 0.0;
}