diff options
| author | historia <[not public]> | 2026-10-03 01:38:58 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-03 01:38:58 -0400 |
| commit | 0ec8f3692960a064616e630c914058298b22897b (patch) | |
| tree | 2b51327eb66be7df8fdcd7c12cc306ca6fa84891 /internal/game/render_roulette.go | |
| parent | 82e571d227feeafd0af4011e701ce26b99c5e3d9 (diff) | |
| download | thehouseoficarus-0ec8f3692960a064616e630c914058298b22897b.tar.gz | |
feat: replaced roulette wheel graphic with line-by-line 'spin'
Diffstat (limited to 'internal/game/render_roulette.go')
| -rw-r--r-- | internal/game/render_roulette.go | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/internal/game/render_roulette.go b/internal/game/render_roulette.go index 218a91f..a0f1e04 100644 --- a/internal/game/render_roulette.go +++ b/internal/game/render_roulette.go @@ -16,8 +16,10 @@ import ( func renderRouletteSnapshot(s *casino.RouletteSnapshot, mode string, unicode bool, size int) string { switch s.Phase { case "playing": - // A blank line on either side keeps the wheel from crowding the prose. - return "\n" + renderRouletteWheel(s.Wheel, mode, unicode) + "\n" + if s.SpinFrame == 0 { + return "" + } + return renderRouletteSpin(s, mode, unicode) case "result": return "\n" + renderRouletteResult(s.Pockets, mode, unicode, size) + "\n" default: @@ -27,6 +29,27 @@ func renderRouletteSnapshot(s *casino.RouletteSnapshot, mode string, unicode boo } } +// A scrolling strip works in telnet scrollback without cursor-control escapes. +func renderRouletteSpin(s *casino.RouletteSnapshot, mode string, unicode bool) string { + var line strings.Builder + for i, pocket := range s.SpinPockets { + fg, _ := roulettePocketColor(pocket) + if fg == 0 { + fg = 8 // visible charcoal rather than invisible black on a dark terminal + } + text := "█" + if !unicode { + text = "#" + } + if i == s.BallPosition { + line.WriteString(roulettePaint(mode, ".", fg)) + } else { + line.WriteString(color.Render(mode, color.ColorSpec{Fg: fg, Bg: -1}, text)) + } + } + return line.String() +} + func rouletteInk(mode, text string) string { return color.Render(mode, color.ColorSpec{Fg: 15, Bg: -1}, text) } |
