All files / player-browser/src/view/shared/playfield text.ts

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

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          6x 6x 6x 6x 6x 6x 6x    
/** The text pass of the shared playfield: the view's late text layer and the pause overlay. */
 
import type { PlayfieldContext } from './context.ts';
 
export function renderText(ctx: PlayfieldContext, width: number, height: number, seconds: number): void {
  ctx.textLayerPool.begin();
  ctx.chrome.drawText?.(seconds);
  ctx.textLayerPool.end();
  ctx.overlay.visible = ctx.play.paused;
  ctx.overlay.text = 'Paused';
  ctx.overlay.anchor.set(0.5);
  ctx.overlay.position.set(width / 2, height / 2);
}