All files / player-browser/src/skins/native playfield.ts

0% Statements 0/3
100% Branches 0/0
0% Functions 0/1
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16                               
import { paintPlayfieldParts, resolvePlayfieldParts } from '@be-music/player-ui';
import type { BeMusicGameplayFrame, BeMusicSurface } from '@be-music/player-skin-sdk';
 
/**
 * The playfield on one stage-sized Canvas, for hosts without DOM gameplay screens. Hosts that mount the native screen
 * draw the same parts on `be-music-playfield`'s own canvases instead.
 */
export function drawPlayfield(
  { context: ctx, width, height }: BeMusicSurface<'2d'>,
  frame: BeMusicGameplayFrame,
): void {
  ctx.fillStyle = '#171717';
  ctx.fillRect(0, 0, width, height);
  paintPlayfieldParts(ctx, resolvePlayfieldParts(frame));
}