All files / player-browser/src/skins/plain index.ts

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

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 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51                                          21x                                                          
import {
  BE_MUSIC_SKIN_API_VERSION,
  cabinetStage,
  defineBeMusicSkin,
  tallStage,
  type BeMusicSkin,
} from '@be-music/player-skin-sdk';
import { drawGameplay } from './gameplay.ts';
import { FONT } from './theme.ts';
import { PORTRAIT_SELECT_LAYOUT } from './layout.ts';
import { drawResult } from './result.ts';
import { SELECT_LAYOUT, SELECT_OUTRO_MS, drawSelect } from './select.ts';
 
/**
 * Plain — the skin SDK's worked example: every screen is drawn with the Canvas 2D API, no Pixi involved. Start here
 * when writing a skin of your own; `gameplay.ts`, `select.ts`, and `result.ts` each draw one screen.
 *
 * Plain also supports portrait screens (a phone or tablet held upright): it declares the 9:16 `tallStage` as its
 * `portraitStage` and a `portraitLayout` for the song list, and each screen checks the surface's orientation and draws
 * its portrait arrangement, placed by the functions in `layout.ts`.
 */
export const plainSkin: BeMusicSkin = defineBeMusicSkin({
  apiVersion: BE_MUSIC_SKIN_API_VERSION,
  id: 'plain',
  label: 'Plain',
  version: '1.0.0',
  author: { name: 'Be-Music', url: 'https://github.com/nulltask/be-music' },
  description: 'A minimal skin drawn with the Canvas 2D API — the skin SDK example.',
  homepage: 'https://github.com/nulltask/be-music',
  license: 'MIT',
  fontLoads: [],
  context: '2d',
  // The 16:9 cabinet stage while the screen is wider than tall, the portrait one otherwise.
  stage: cabinetStage,
  portraitStage: tallStage,
  // Plain's ink with its line grey in faint stripes, and the line grey along the edge the notes come from.
  gameplay: {
    draw: drawGameplay,
    laneCover: { color: 0x111114, stripeColor: 0x3a3a42, stripeAlpha: 0.5, edgeColor: 0x3a3a42 },
    // Plain's system sans, in its note blue, highlight yellow, text white and danger red.
    guideLabel: {
      fontFamily: FONT,
      fontWeight: '600',
      fontSize: 11,
      colors: { bpm: 0x6fdc8c, stop: 0xffd84d, scroll: 0x5b8cff, speed: 0xff4d5e },
    },
  },
  select: { layout: SELECT_LAYOUT, portraitLayout: PORTRAIT_SELECT_LAYOUT, outroMs: SELECT_OUTRO_MS, draw: drawSelect },
  result: { draw: drawResult },
});