Skip to content

CG-0MPPL0PSI002GGVB: Migrate Golf to use shared Renderer API#589

Merged
SorraTheOrc merged 4 commits into
mainfrom
feature/CG-0MPPL0PSI002GGVB-golf-renderer-migration
May 31, 2026
Merged

CG-0MPPL0PSI002GGVB: Migrate Golf to use shared Renderer API#589
SorraTheOrc merged 4 commits into
mainfrom
feature/CG-0MPPL0PSI002GGVB-golf-renderer-migration

Conversation

@SorraTheOrc
Copy link
Copy Markdown
Member

Summary

Migrate Golf game rendering to use the shared Renderer API via a GolfAdapter, following the same adapter pattern established by Main Street and The Mind in CG-0MP12VWO1003YL55.

Changes

  • Created GolfAdapter.ts: Re-exports shared helpers (createHudText, createActionButton, createHudContainer, getCardTexture, createSceneTitle, createSceneMenuButton, createOverlayBackground, dismissOverlay) and provides Golf-specific wrappers (createGolfHudText with Golf font/depth defaults, createGolfMenuButton for menu navigation)
  • Migrated GolfOverlayManager.ts: Uses createActionButton, createGolfHudText, createGolfMenuButton from adapter; removed direct scene.add.text() calls
  • Migrated GolfRenderer.ts: Uses createGolfHudText for all text elements (labels, scores, instructions); imports card textures and scene helpers via adapter
  • Migrated GolfReplayController.ts: Uses createActionButton for takeover overlay buttons, createGolfHudText for text
  • Enhanced shared Renderer: Added align and lineSpacing to HudTextOptions / createHudText for text formatting support
  • Fixed browser test: Dispatches MouseEvent instead of PointerEvent (Phaser 4 RC7's MouseManager listens for mousedown/mouseup, and synthetic PointerEvents don't auto-generate matching MouseEvents)

Test Results

  • ✅ Build passes
  • ✅ 203 test files pass, 2930 tests pass (5 skipped)

Review Focus

  • Verify the Golf adapter pattern matches the established convention from MainStreetAdapter and TheMindAdapter
  • Check that Golf overlay buttons and replay controller buttons work correctly with the shared createActionButton
  • Confirm no visual regressions in Golf game rendering

Map added 4 commits May 29, 2026 00:05
…adapter

- Create SushiGoAdapter.ts bridging Sushi Go overlays to shared Renderer helpers
- Replace createOverlayButton/createOverlayMenuButton with createActionButton/createSushiGoMenuButton in SushiGoOverlayManager
- Update browser tests to verify Container-based button structure
- No visual regressions; all 2821 tests pass
…r API

- Create BeleagueredCastleAdapter.ts with re-exported shared helpers and
  createBcHudText factory for BC-specific HUD text styling.
- Update BeleagueredCastleRenderer.createHUD() to use createHudText and
  createActionButton instead of direct Phaser API calls.
- Update BeleagueredCastleRenderer.refreshUndoRedoButtons() to use alpha
  instead of color manipulation for disabled state.
- Update BeleagueredCastleOverlayManager to use createHudText for stats
  and title text in win/no-moves overlays.
- Remove unused FONT_FAMILY import from renderer.
…score overlay

Root cause: createActionButton creates Containers at default depth 0,
but overlay backgrounds sit at depth 10, hiding buttons behind them.

Fix:
- Add depth option to ActionButtonOptions in shared Renderer API
- Set container depth when depth option is provided in createActionButton
- Pass { depth: 11 } to all three overlay button calls in SushiGoOverlayManager
- Pass depth option through createSushiGoMenuButton wrapper

Test:
- New browser test 'renders Next Round button above overlay background depth'
  checks Container depth >= 11 and background rectangle is interactive
- Created GolfAdapter re-exporting shared helpers with Golf-specific
  wrappers (createGolfHudText, createGolfMenuButton)
- Migrated GolfOverlayManager to use createActionButton, createGolfHudText,
  createGolfMenuButton from GolfAdapter
- Migrated GolfRenderer to use createGolfHudText for all text rendering
- Migrated GolfReplayController to use createActionButton, createGolfHudText
- Added align and lineSpacing support to HudTextOptions
- Fixed GolfOverlay browser test: use MouseEvent instead of PointerEvent
  (Phaser 4 RC7 MouseManager listens for mousedown/mouseup, not pointerdown/pointerup)
- Updated renderer unit tests for changed interaction target
@SorraTheOrc SorraTheOrc merged commit aa27181 into main May 31, 2026
1 check failed
@SorraTheOrc SorraTheOrc deleted the feature/CG-0MPPL0PSI002GGVB-golf-renderer-migration branch May 31, 2026 16:57
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