shithub: puzzles

Download patch

ref: 56237fa5fa0c2c56785f3667cb7d013dc9779352
parent: 29eaa8f55c7b9cc960afa4327a7ce977e6637e9c
author: Ben Harris <bjh21@bjh21.me.uk>
date: Mon Jul 31 18:39:33 EDT 2023

Same Game: scale TILE_GAP with tilesize

TILE_GAP represents the gap between the coloured parts of adjacent
different-coloured tiles.  Rather than a fixed 2 pixels, it's now 1/16
of the tilesize (rounded to nearest).

This looks the same at the default tilesize of 32, but behaves better
with larger or smaller tilesizes.  At tilesizes below 8, the gap
disappears altogether, but that seems appropriate: at 7 pixels there's
not much space for the inner and outer squares and the cursor, and those
are all more important than the gap..

--- a/samegame.c
+++ b/samegame.c
@@ -1370,7 +1370,7 @@
 static void game_set_size(drawing *dr, game_drawstate *ds,
                           const game_params *params, int tilesize)
 {
-    ds->tilegap = 2;
+    ds->tilegap = (tilesize + 8) / 16;
     ds->tileinner = tilesize - ds->tilegap;
 }