teaser: render.ts --scale 2, the 3840x2160 master for 4K uploads (same page at device scale 2, desktop frames captured at @3x into out/desktop@3x, demo game renders at 2x into out/assets@2x, H.264 high about 40 Mbps, AAC 320 kbps, +faststart; no web version); desktop.ts captureDesktop takes a scale and an output folder

This commit is contained in:
CRTkafa 2026-10-14 04:27:49 +08:00
parent 8a0a05dca2
commit d1159313ac
3 changed files with 34 additions and 15 deletions

View file

@ -39,7 +39,7 @@ import { launch } from '../../cli/shots/browser';
const DIR = import.meta.dir;
const ROOT = join(DIR, '../..');
const OUT = join(DIR, 'out/desktop');
const DEFAULT_OUT = join(DIR, 'out/desktop');
export const VIEW = { width: 1280, height: 800 };
const log = (m: string): void => console.log(`${new Date().toISOString().slice(11, 19)} [desktop] ${m}`);
@ -64,7 +64,9 @@ export function realConsolePlan(form: string): Record<string, unknown> {
} finally { rmSync(dir, { recursive: true, force: true }); }
}
export async function captureDesktop(): Promise<void> {
/** `scale` is the device scale of the captures (2: 2560x1600, the default; 3 for the 4K master), `dir` where they go. */
export async function captureDesktop(o: { scale?: number; dir?: string } = {}): Promise<void> {
const OUT = o.dir ?? DEFAULT_OUT, SCALE = o.scale ?? 2;
mkdirSync(OUT, { recursive: true });
const privacyPlan = realConsolePlan('apple-app-privacy');
const port = 14_300 + Math.floor(Math.random() * 500);
@ -84,7 +86,7 @@ export async function captureDesktop(): Promise<void> {
const errors: string[] = [];
const session = async (clean: boolean, waiting = false) => {
const ctx = await browser.newContext({ viewport: VIEW, deviceScaleFactor: 2, colorScheme: 'dark', reducedMotion: 'reduce' });
const ctx = await browser.newContext({ viewport: VIEW, deviceScaleFactor: SCALE, colorScheme: 'dark', reducedMotion: 'reduce' });
// the console plan panel shows the real plan of the CLI instead of the fixture's shortened one; after the submit
// (waiting), the fixture's apple status holds the new submission waiting for review
await ctx.route(/\/src\/dev\/submit-fixtures\.ts/, async (route: any) => {