From 5e7400403c2f711352255f373b50850d4b2f4e63 Mon Sep 17 00:00:00 2001 From: Kyle Swarner Date: Thu, 21 Nov 2024 11:55:38 -0500 Subject: [PATCH] Untangle: allow frontends to alter some dimensions. This change to Untangle allows for custom frontends to optionally define their own CIRCLE_RADIUS and DRAG_THRESHOLD parameters. Rationale: The hardcoded values provided here (specifically a 6px circle radius) is far too small for many modern pixel-dense devices, requiring frontends to duplicate files locally to fix. Adding #ifndef conditionals around these two values allow them to be configured by the frontend without the need to fork the files. The changes here are what I made to support my custom iOS frontend (Puzzles Reloaded) and work well. --- untangle.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/untangle.c b/untangle.c index 9196d88..fea80ad 100644 --- a/untangle.c +++ b/untangle.c @@ -40,8 +40,14 @@ #include "puzzles.h" #include "tree234.h" -#define CIRCLE_RADIUS 6 -#define DRAG_THRESHOLD (CIRCLE_RADIUS * 2) +#ifndef CIRCLE_RADIUS +# define CIRCLE_RADIUS 6 +#endif + +#ifndef DRAG_THRESHOLD +# define DRAG_THRESHOLD (CIRCLE_RADIUS * 2) +#endif + #define PREFERRED_TILESIZE 64 #define FLASH_TIME 0.30F