diff --git a/README.md b/README.md index a8f40e87..659287f5 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,10 @@ User-facing documentation lives at https://faceclaw.org/. ![App launcher](website/screenshots/launcher.png) ![Music player](website/screenshots/music-player.png) +![Customization settings](website/screenshots/settings-customization.png) ![Assistant settings](website/screenshots/settings-assistant.png) -![Display settings](website/screenshots/settings-display.png) ![Compass](website/screenshots/compass.png) +![Blocks](website/screenshots/blocks.png) ## Installation diff --git a/app/apps/blocks/blocks-app.worker.ts b/app/apps/blocks/blocks-app.worker.ts index fb4ffd3b..2b570197 100644 --- a/app/apps/blocks/blocks-app.worker.ts +++ b/app/apps/blocks/blocks-app.worker.ts @@ -46,6 +46,12 @@ const CELL = 12; const BOARD_X = 60; const BOARD_Y = 10; const PANEL_X = 230; +/** + * Height the layout above is drawn for: a min-height window's viewport under + * the standard top bar. A taller viewport (the status bar folded into the + * switcher row, a full-panel display) centers it vertically. + */ +const LAYOUT_HEIGHT = 260; /** * Gravity starts here and speeds up with score (see dropIntervalMs). Slow @@ -601,7 +607,7 @@ function paint(window: BlocksWindow): Plane[] { } function paintContent(window: BlocksWindow): GrayImage { - const image = new GrayImage(window.viewportWidth, window.viewportHeight, 0); + const image = new GrayImage(window.viewportWidth, LAYOUT_HEIGHT, 0); image.drawRect(BOARD_X - 2, BOARD_Y - 2, COLS * CELL + 4, ROWS * CELL + 4, 120); if (window.phase === "paused") { // Hide the board so pausing can't be used to study the stack. @@ -613,6 +619,14 @@ function paintContent(window: BlocksWindow): GrayImage { if (window.phase === "game-over") paintGameOver(image); } paintPanel(image, window); + return centeredInViewport(window, image); +} + +/** Place the fixed-height layout vertically centered in the window's viewport. */ +function centeredInViewport(window: BlocksWindow, layout: GrayImage): GrayImage { + if (layout.height === window.viewportHeight) return layout; + const image = new GrayImage(window.viewportWidth, window.viewportHeight, 0); + layout.composeInto(image, 0, Math.max(0, Math.floor((window.viewportHeight - layout.height) / 2))); return image; } @@ -639,7 +653,41 @@ function paintBoard(image: GrayImage, window: BlocksWindow): void { } function drawCell(image: GrayImage, x: number, y: number, shade: number): void { - image.fillRect(BOARD_X + x * CELL, BOARD_Y + y * CELL, CELL - 1, CELL - 1, shade); + drawTile(image, BOARD_X + x * CELL, BOARD_Y + y * CELL, shade); +} + +/** + * One beveled tile (CELL - 1 square, leaving a 1px gap): lit top and left + * edges, shadowed bottom and right, stepping in over two rings to a raised + * face. The face keeps the piece's shade, so pieces stay distinguishable by + * brightness after 4bpp quantization. + */ +function drawTile(image: GrayImage, x: number, y: number, shade: number): void { + const size = CELL - 1; + const lit = (amount: number): number => Math.round(shade + (255 - shade) * amount); + const dim = (factor: number): number => Math.round(shade * factor); + image.fillRect(x, y, size, size, dim(0.8)); + drawBevelRing(image, x, y, size, lit(0.6), dim(0.4), shade); + drawBevelRing(image, x + 1, y + 1, size - 2, lit(0.3), dim(0.6), shade); + image.fillRect(x + 3, y + 3, size - 6, size - 6, shade); +} + +/** A square's 1px edge: light along the top and left, dark along the bottom and right, mid at the two mixed corners. */ +function drawBevelRing( + image: GrayImage, + x: number, + y: number, + size: number, + light: number, + dark: number, + mid: number, +): void { + image.fillRect(x, y, size, 1, light); + image.fillRect(x, y, 1, size, light); + image.fillRect(x, y + size - 1, size, 1, dark); + image.fillRect(x + size - 1, y, 1, size, dark); + image.setPixel(x + size - 1, y, mid); + image.setPixel(x, y + size - 1, mid); } function paintGameOver(image: GrayImage): void { @@ -665,7 +713,7 @@ function paintPanel(image: GrayImage, window: BlocksWindow): void { const offsetX = PANEL_X + Math.round((previewBoxSize - (maxX - minX + 1) * CELL) / 2); const offsetY = previewY + Math.round((previewBoxSize - (maxY - minY + 1) * CELL) / 2); for (const [cx, cy] of cells) { - image.fillRect(offsetX + (cx - minX) * CELL, offsetY + (cy - minY) * CELL, CELL - 1, CELL - 1, def.shade); + drawTile(image, offsetX + (cx - minX) * CELL, offsetY + (cy - minY) * CELL, def.shade); } const statX = PANEL_X + previewBoxSize + 40; diff --git a/app/apps/pinball/pinball-app.worker.ts b/app/apps/pinball/pinball-app.worker.ts index 57c6a5ea..9881d602 100644 --- a/app/apps/pinball/pinball-app.worker.ts +++ b/app/apps/pinball/pinball-app.worker.ts @@ -63,6 +63,12 @@ const TOP = 4; const BOTTOM = 256; const LANE_X = 232; const PANEL_X = 310; +/** + * Height the table and panel are drawn for: a min-height window's viewport + * under the standard top bar. A taller viewport (the status bar folded into + * the switcher row, a full-panel display) centers the layout vertically. + */ +const LAYOUT_HEIGHT = 260; const BALL_R = 6; /** Ball resting spot on the plunger, and where launches start. */ @@ -894,8 +900,8 @@ let staticBackground: GrayImage | null = null; /** Everything that never changes: walls, guides, slings, outlines, labels. */ function getStaticBackground(window: PinballWindow): GrayImage { - if (staticBackground) return staticBackground; - const image = new GrayImage(window.viewportWidth, window.viewportHeight, 0); + if (staticBackground?.width === window.viewportWidth) return staticBackground; + const image = new GrayImage(window.viewportWidth, LAYOUT_HEIGHT, 0); for (const segment of SEGMENTS) { image.drawLine(segment.x0, segment.y0, segment.x1, segment.y1, segment.shade); } @@ -995,6 +1001,14 @@ function paintContent(window: PinballWindow): GrayImage { `${GESTURE_CLICK} new game`, ]); } + return centeredInViewport(window, image); +} + +/** Place the fixed-height layout vertically centered in the window's viewport. */ +function centeredInViewport(window: PinballWindow, layout: GrayImage): GrayImage { + if (layout.height === window.viewportHeight) return layout; + const image = new GrayImage(window.viewportWidth, window.viewportHeight, 0); + layout.composeInto(image, 0, Math.max(0, Math.floor((window.viewportHeight - layout.height) / 2))); return image; } diff --git a/website/index.html b/website/index.html index baa2a341..0e943e3d 100644 --- a/website/index.html +++ b/website/index.html @@ -63,18 +63,22 @@ The music player on the glasses display
Media controls, working with most Android media players.
+
+ +
Customization settings
+
Assistant settings on the glasses display
Assistant settings, edited on the glasses themselves.
-
- Display settings on the glasses display -
Display settings, including screen size and font.
-
The compass app
Compass app.
+
+ Blocks +
On-glasses games.
+
diff --git a/website/screenshots/blocks.png b/website/screenshots/blocks.png new file mode 100644 index 00000000..53c76562 Binary files /dev/null and b/website/screenshots/blocks.png differ diff --git a/website/screenshots/compass.png b/website/screenshots/compass.png index a4fc51f5..0ae4feb1 100644 Binary files a/website/screenshots/compass.png and b/website/screenshots/compass.png differ diff --git a/website/screenshots/launcher.png b/website/screenshots/launcher.png index 58c940ac..82213cf6 100644 Binary files a/website/screenshots/launcher.png and b/website/screenshots/launcher.png differ diff --git a/website/screenshots/music-player.png b/website/screenshots/music-player.png index d9933ac8..a687e75e 100644 Binary files a/website/screenshots/music-player.png and b/website/screenshots/music-player.png differ diff --git a/website/screenshots/screenshot-launcher.png b/website/screenshots/screenshot-launcher.png deleted file mode 100644 index 79e060f5..00000000 Binary files a/website/screenshots/screenshot-launcher.png and /dev/null differ diff --git a/website/screenshots/settings-assistant.png b/website/screenshots/settings-assistant.png index c2aa9bb7..0f1a8f58 100644 Binary files a/website/screenshots/settings-assistant.png and b/website/screenshots/settings-assistant.png differ diff --git a/website/screenshots/settings-customization.png b/website/screenshots/settings-customization.png new file mode 100644 index 00000000..8397f56c Binary files /dev/null and b/website/screenshots/settings-customization.png differ diff --git a/website/screenshots/settings-display.png b/website/screenshots/settings-display.png deleted file mode 100644 index ec36a09d..00000000 Binary files a/website/screenshots/settings-display.png and /dev/null differ