Trick games: full SVG table (opponents, trick, fanned hand)

* cg-trick.el (cg-trick--svg, cg-trick--draw-backs): draw the whole table
as one SVG -- three opponents, the trick in a diamond, the South hand
fanned with cursor, legal-play hints, and pass marks; hand cards carry
(hand . INDEX) click regions.  (cg-trick--render-text): the text fallback.
(cg-render): dispatch SVG on a graphical display, else text.  Add a footer
legend; refresh the help.  Covers Hearts, Spades, Whist, Oh Hell, and the
Euchre/Pitch/Briscola subclasses.
* test/card-games-tests.el: add cgt-trick-svg-smoke, cgt-trick-svg-bidding.
* NEWS: note the trick-taking SVG table.
This commit is contained in:
Corwin Brust 2026-07-01 04:23:20 -05:00
parent 400e5830be
commit 98b297d149
18 changed files with 941 additions and 14 deletions

View file

@ -79,9 +79,11 @@
:type 'string :group 'cg-svg)
(defcustom cg-svg-theme-colors t
"Derive the highlight ring and card back from the active theme.
When non-nil, colours are taken from the active Emacs theme, with the
colour variables below as fallbacks."
"Derive the card back and move-hint ring from the active theme.
When non-nil, those colours are taken from the active Emacs theme, with
the colour variables below as fallbacks. The cursor/selection ring is
not themed this way -- see `cg-svg--highlight' -- so it never picks up a
theme's `region' colour."
:type 'boolean :group 'cg-svg)
(defcustom cg-svg-card-back 'dots
@ -111,10 +113,13 @@ hearts red."
(defvar cg-svg-gap-color "#95a5a6" "Empty-slot outline colour.")
(defun cg-svg--highlight ()
"Resolve the cursor/selection ring colour (theme-aware)."
(if cg-svg-theme-colors
(cg-color 'region :background cg-svg-highlight-color)
cg-svg-highlight-color))
"Resolve the cursor/selection ring colour.
Always the configured `cg-svg-highlight-color' (a calm gold by
default). This is deliberately not taken from the theme's `region'
face: on many themes that face is a saturated colour, and a fat ring
in it reads as an alarming frame flashing around the whole board on
each redraw. Customize `cg-svg-highlight-color' to change it."
cg-svg-highlight-color)
(defun cg-svg--back-fill ()
"Resolve the card-back fill colour (theme-aware)."