Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

GameOverlay

Renders help and game results from an overlay controller.

import { GameOverlay } from 'filedom';

<GameOverlay
  control={controls}
  status={status}
  width={1440}
  height={900}
  iconSize={96}
/>

Create controls with useGameControls or useGameOverlay. Render GameOverlay inside a StageProvider, after the play stage, so its files are created last and draw on top. The overlay runs its own Stage and park, and inherits the cover colour from the enclosing provider.

The overlay draws two Text blocks: the ? help panel, shown only while status is playing, and the result banner, shown for won, lost and draw. Their tiles own their files. On a win it also shows up to four accent icons. The accents are its only pooled sprites and the only thing its stage prebakes (gameOverlayPrebake(handle)); winEffect: 'none' turns them off. The controller’s help and banner TextStyle options set how each text block is drawn. A help panel with a grid shape is anchored at the bottom of the desktop instead of the center.

Props

PropType
controlGameOverlayController

Overlay configuration and help state.

TypeGameOverlayController
statusGameResultStatus

playing, won, lost, or draw.

TypeGameResultStatus
widthnumber

Desktop width; the overlay centers on it.

Typenumber
heightnumber

Desktop height; the overlay centers on it.

Typenumber
iconSizenumber

Finder icon size, used to scale the text and accents.

Typenumber
park?StagePoint

Park override. Defaults to { x: width - iconSize, y: height - iconSize }.

TypeStagePoint

Was this page helpful?