Add a pinball game

This commit is contained in:
James Babcock committed 2026-07-26 21:03:52 -07:00
1 parent 434419c8e4
commit 4c946631e0
5 files changed
+1089 -1

No files matched your search

+20
View File
@@ -161,6 +161,7 @@ const LAUNCHER_APPS: LauncherAppEntry[] = [
{ appId: "blocks", label: "Blocks", icon: "l-piece" },
{ appId: "minesweeper", label: "Minesweeper", icon: "bomb" },
{ appId: "freecell", label: "Freecell", icon: "spade" },
{ appId: "pinball", label: "Pinball", icon: "pinball" },
{ appId: "debug-tests", label: "Debug tests", icon: "flask-conical" },
{ appId: "settings", label: "Settings", icon: "settings" },
];
@@ -1230,6 +1231,8 @@ class DashboardController {
worker = new Worker("../workers/minesweeper-app.worker");
} else if (appId === "freecell") {
worker = new Worker("../workers/freecell-app.worker");
} else if (appId === "pinball") {
worker = new Worker("../workers/pinball-app.worker");
} else {
return null;
}
@@ -1383,6 +1386,23 @@ class DashboardController {
this.appendLog("launched freecell:main");
return;
}
if (appId === "pinball") {
const existing = shell.getWindows().find((window) => window.appId === "pinball");
if (existing) {
shell.focusWindow(existing.windowId);
this.requestShellRender();
return;
}
host.openWindow({
windowId: "pinball:main",
title: "Pinball",
iconLetter: "P",
icon: "pinball",
focus: true,
});
this.appendLog("launched pinball:main");
return;
}
if (appId === "navigate") {
// Navigation needs precise location; prompt on the phone while the
// window opens (the worker can't show permission dialogs).
+7
View File
@@ -27,6 +27,9 @@ export const ICON_SVGS = {
'<svg viewBox="0 0 24 24" fill="none"><rect width="6" height="6" x="5" y="1.5" rx="1"/><rect width="6" height="6" x="5" y="9" rx="1"/><rect width="6" height="6" x="5" y="16.5" rx="1"/><rect width="6" height="6" x="12.5" y="16.5" rx="1"/></svg>',
bomb:
'<svg viewBox="0 0 24 24" fill="none"><circle cx="11" cy="13" r="9"/><path d="M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95"/><path d="m22 2-1.5 1.5"/></svg>',
// Not a Lucide icon: a ball above two angled flippers, for Pinball.
pinball:
'<svg viewBox="0 0 24 24" fill="none"><circle cx="12" cy="6" r="3"/><path d="M4 14l7 5"/><path d="M20 14l-7 5"/><circle cx="4" cy="14" r="1"/><circle cx="20" cy="14" r="1"/></svg>',
spade:
'<svg viewBox="0 0 24 24" fill="none"><path d="M12 18v4"/><path d="M2 14.499a5.5 5.5 0 0 0 9.591 3.675.6.6 0 0 1 .818.001A5.5 5.5 0 0 0 22 14.5c0-2.29-1.5-4-3-5.5l-5.492-5.312a2 2 0 0 0-3-.02L5 8.999c-1.5 1.5-3 3.2-3 5.5"/></svg>',
terminal:
@@ -37,6 +40,10 @@ export const ICON_SVGS = {
'<svg viewBox="0 0 24 24" fill="none"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',
folder:
'<svg viewBox="0 0 24 24" fill="none"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>',
// The same Lucide folder shape without fill="none", so the renderer fills
// it: launcher folders use this to read differently from the Files app.
"folder-filled":
'<svg viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>',
image:
'<svg viewBox="0 0 24 24" fill="none"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
film:
+1 -1
View File
@@ -180,7 +180,7 @@ class LauncherGridLayer implements Layer {
const blockTop = rowY(row) + Math.max(2, (rowH - ICON_SIZE - font.lineHeight - LABEL_GAP) / 2);
if (blockTop >= gridBottom) break; // fully below the grid
const centerX = (index % COLS) * colW + colW / 2;
const icon = renderIcon(entry.kind === "app" ? entry.icon : "folder", ICON_SIZE);
const icon = renderIcon(entry.kind === "app" ? entry.icon : "folder-filled", ICON_SIZE);
if (icon) {
// Clip the icon at the grid bottom so a peeking row shows only its top.
const clipHeight = Math.min(icon.height, Math.floor(gridBottom - blockTop));
+2
View File
@@ -13,7 +13,9 @@ const STORAGE_KEY = "launcher.folders";
/** The out-of-the-box grouping, applied only while the setting is unset. */
const DEFAULT_ASSIGNMENTS: Record<string, string> = {
blocks: "Games",
freecell: "Games",
minesweeper: "Games",
pinball: "Games",
};
export const FOLDER_NAME_MAX_LENGTH = 24;
File diff suppressed because it is too large. Load diff