From e920b20fafe375eec15b24eb8cde4b1455dd01af Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 1 Nov 2026 20:11:41 +0100 Subject: v4.1.1: pointer-first betting and visible payouts in the GUI The felt snaps the hover to the shared fine lattice: inner half of a cell is a straight, an edge a split, a crossing a corner. A translucent chip previews the target and the covered cells tint. Left click adds the selected chip, right or middle click takes one back through the new Bets::reduce; C or CLEAR empties the slip, and SPIN stays disabled with no chips. The result now pays out: the wheel leaves the winning pocket under the pointer, the winning cell and pocket get a gold outline, and the sidebar reports the amount returned and the net for the round (NO WIN on a loss). Placing a chip after a result starts the next round without losing the wheel position. The column row now spans the full width like a real table instead of hugging the left edge. Adds tests for lattice snapping, target naming and taking chips back. --- src/client/games/roulette.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client') diff --git a/src/client/games/roulette.rs b/src/client/games/roulette.rs index ec9573c..f0ed816 100644 --- a/src/client/games/roulette.rs +++ b/src/client/games/roulette.rs @@ -95,7 +95,7 @@ impl Cursor { pub fn target(&self) -> Option { match self { Cursor::Zero => Some(BetTarget::Straight { number: 0 }), - Cursor::Lattice { x, y } => felt_target(*x, *y), + Cursor::Lattice { x, y } => target_at(*x, *y), Cursor::Dozen(index) => Some(BetTarget::Dozen { index: *index as u8, }), @@ -171,7 +171,11 @@ fn cell_number(column: usize, row: usize) -> Option { } /// Bet under a point of the fine grid. -fn felt_target(x: usize, y: usize) -> Option { +/// +/// Both frontends use this: the terminal moves a cursor over the lattice, and +/// the GUI snaps a mouse position to it. Odd coordinates are cell centres, +/// even coordinates are the lines where a split or corner chip sits. +pub fn target_at(x: usize, y: usize) -> Option { if !(1..=FELT_X_MAX).contains(&x) || !(1..=FELT_Y_MAX).contains(&y) { return None; } -- cgit v1.2.3