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

@ -288,5 +288,24 @@ The clicked display string must carry a `cg-regions' text property."
(interactive)
(setq cg-card-scale 1.0) (cg-card-refresh))
(defun cg-insert-legend (text)
"Insert TEXT as a shadowed one-line control legend in the current buffer.
Games call this at the foot of the board so the common controls -- a
new deal, undo, help, and returning to the menu -- stay visible instead
of hiding behind a keystroke."
(insert (propertize (concat " " text "\n") 'face 'shadow)))
(defun cg-quit-to-menu ()
"Leave the current game and return to the `card-game' chooser.
Buries the game buffer and reopens the game list, so `q' takes the
player back to where they started rather than to whatever buffer
happened to be underneath. Falls back to `quit-window' when the
chooser is not available (for example a game loaded on its own)."
(interactive)
(let ((game (current-buffer)))
(if (fboundp 'card-game)
(progn (card-game) (bury-buffer game))
(quit-window))))
(provide 'cg-core)
;;; cg-core.el ends here