Skip to content

fix(nr-use): the light-gun sight no longer hides the web picture behind black - #3394

Merged
rmstdope merged 2 commits into
mainfrom
nr-use-4
Oct 25, 2026
Merged

rmstdope merged 2 commits into
mainfrom
nr-use-4

Conversation

@rmstdope

Copy link
Copy Markdown
Owner

Bead: nr-use (Vs. Duck Hunt cannot be played). This answers the verification failure of 2026-10-25 at fbcd199.

The bug

On web, the picture went black whenever the mouse was captured and the Zapper sight showed. Escape brought it back. The sight is drawn on a second canvas laid over the game picture. #3352 (Steel Glow) added canvas { background: #000 } to web/main.css for every canvas, so that overlay turned into an opaque black sheet. The Super Scope sight uses the same overlay, so it had the same problem.

The fix

createCrosshair now gives its overlay an inline background: transparent. The game canvas keeps its black backing.

Reproduction test

web/src/display/crosshair_overlay_style.test.ts loads the real main.css into jsdom, creates the sight over a #screen canvas, and checks the overlay's computed background. It got rgb(0, 0, 0) before the fix and gets rgba(0, 0, 0, 0) now.

Validation

  • ./scripts/gate-full.sh --fast: passed
  • pnpm run typecheck: passed. pnpm test: 96 files and 1043 tests passed
  • In Chrome, on the built web shell with duck-hunt-vs.nes and a simulated pointer lock: black before the fix, game visible under the sight after it.

Not changed here: right after capture, the sight is drawn at the top-left corner until the mouse first moves. That was already the case before this fix.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QmNN1L1G3mw6Daxa3WfkCj

rmstdope and others added 2 commits October 25, 2026 03:00
…nd black

The stylesheet paints every canvas black, and the sight's overlay is a
canvas over the picture, so capturing the mouse in Vs. Duck Hunt on web
covered the game. The overlay now declares a transparent background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QmNN1L1G3mw6Daxa3WfkCj
@rmstdope

Copy link
Copy Markdown
Owner Author

Review (cold read, reviewed_head: 373f9265): reviewed before merge under the producer's review practice by an agent that was given the diff and the bead, not the producer's reasoning. A bug bead has no plan, so the review read the diff against three things: the bead's bug claim, the failed-verification note of 2026-10-25 and the reproduction test.

No blocking findings. The reviewer checked the cause against the code:

  • feat(web): Steel Glow look on today's layout #3352 (7de66f05) added canvas { background: #000 } to web/main.css.
  • That rule covers the sight's overlay canvas, which sits at zIndex 10 over #screen.
  • setCrosshairVisible creates that overlay only while the mouse is captured. This matches the report: black while captured, and the picture comes back on Escape.
  • No other on-screen canvas is affected.

The inline background: transparent beats the element rule. The reviewer ran the test against the parent crosshair.ts: it fails there (rgb(0, 0, 0)) and passes at head.

  1. (non-blocking) crosshair_overlay_style.test.ts does not stub HTMLCanvasElement.prototype.getContext, so jsdom prints "Not implemented" while the test runs. The sibling tests stub it.

Producer's answers

  1. Fixed in the follow-up commit: the test now stubs getContext, and its output is clean. The change is test-only and touches no behaviour, so I did not ask for a follow-up review.

@rmstdope
rmstdope merged commit 4747655 into main Oct 25, 2026
11 checks passed
@rmstdope
rmstdope deleted the nr-use-4 branch October 25, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant