Phones: interface scale capped at 1.7; settings fields for wave 2

The user lowered the cap from 1.8 so the smallest iPhones (SE, 13 mini) keep a canvas about
635 px tall. GameSettings gains swap_sticks, camera_distance (FollowCamera.PHONE_DISTANCE) and
haptics, unsaved for now, so #38's apply_settings and #41's settings can be built in parallel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-14 14:48:32 -04:00
parent f072bac176
commit 5392ae09af
4 changed files with 16 additions and 9 deletions

View file

@ -77,8 +77,10 @@ Ads and the remove-ads purchase come in the next plan, once the game plays well
**Screen**
9. **Interface scale.** It's set automatically from the screen's physical size: about 1.6× on
phones, 1× on iPads and desktop. An Interface size setting (80–130%) adjusts it. At 1.6× on a
19.5:9 phone the canvas is about 1460×675, which every menu and panel must fit.
phones, 1× on iPads and desktop, **capped at 1.7×** (the user's call, 2026-10-14). An Interface
size setting (80–130%) adjusts it. At 1.6× on a 19.5:9 phone the canvas is about 1460×675; at
the 1.7 cap (iPhone SE, 13 mini) it's about 635 tall (SE: about 1130×635). Every menu and panel
must fit 635 px tall.
10. **Safe area.** Every HUD widget and menu stays inside it, clear of the notch, the rounded
corners, and the home indicator.
11. **World labels** (Gather, Repair, a structure's name) draw as flat text on phones
@ -176,7 +178,7 @@ side gets Place and Done. The build bar replaces the hotbar.
(#46, the sprint change, is in wave 1 too. Its section is after #44.)
- `MobilePort.ui_scale()`: work out the physical screen height in inches from
`DisplayServer.screen_get_size()` and `screen_get_dpi()`. Use `clampf(4.3 / inches, 1.0, 1.8)`,
`DisplayServer.screen_get_size()` and `screen_get_dpi()`. Use `clampf(4.3 / inches, 1.0, 1.7)` (the cap was 1.8; the user lowered it after #35),
which gives about 1.6 on phones and 1.0 on iPads, times `GameSettings.interface_size` (0.8–1.3,
default 1.0). Desktop is always 1.0. **Check `screen_get_dpi()` on an iPhone through the
PerfTest overlay before relying on it.** If it's wrong or 0, fall back to the screen's

View file

@ -37,6 +37,11 @@ var player_name := ""
var microphone := true
## Phones: the Interface size, 0.8-1.3 times the scale the screen calls for (MobilePort.ui_scale).
var interface_size := 1.0
## Phones: the sticks swapped (move on the left: TouchSticks, TouchButtons), the camera's distance
## (FollowCamera, 8-20 m), and a short buzz when the scarecrow is hit. Saved and applied by #41.
var swap_sticks := false
var camera_distance := FollowCamera.PHONE_DISTANCE
var haptics := true
static func load_from(path: String = PATH) -> GameSettings:

View file

@ -32,7 +32,7 @@ static func perf_test() -> bool:
## --- The interface on a phone: its scale, the safe area, and the touch target ---
## ui_scale() is the root window's content_scale_factor on a phone (GameSettings.apply). It
## scales every CanvasLayer (the HUD, the menus, the sticks) and leaves the 3D view alone. It's
## worked out from the screen's physical size: clampf(4.3 / the shorter side in inches, 1, 1.8),
## worked out from the screen's physical size: clampf(4.3 / the shorter side in inches, 1, 1.7),
## about 1.6 on a phone and 1 on an iPad, times the Interface size setting (0.8-1.3). At 1.6 a
## 19.5:9 phone's canvas is about 1460x675 instead of 2340x1080. Desktop is always 1.
## The density (screen_get_dpi) isn't trusted blindly: when it's 0 or impossible for a phone or a
@ -50,7 +50,7 @@ const TARGET_PT := 44.0
## The scale from the screen's size: this many inches across the shorter side is 1x.
const REFERENCE_INCHES := 4.3
const MIN_SCALE := 1.0
const MAX_SCALE := 1.8
const MAX_SCALE := 1.7 # the user's cap (2026-10-14): keeps the smallest iPhones' canvas about 635 tall
## The size class, when the density can't be trusted: a phone's shorter side is below this many
## points, and gets PHONE_SCALE; anything bigger is a tablet (TABLET_SCALE).
const PHONE_POINTS := 500.0
@ -96,7 +96,7 @@ static func screen_scale() -> float:
## The scale for a screen this many pixels across, at this density (dots per inch), with this
## many pixels per point: clampf(4.3 / the shorter side in inches, 1, 1.8). When the density
## many pixels per point: clampf(4.3 / the shorter side in inches, 1, 1.7). When the density
## can't be right (dpi_plausible), the size class: below PHONE_POINTS points across the shorter
## side is a phone (1.6), else a tablet (1).
static func scale_for(pixels: Vector2, dpi: float, per_point: float) -> float:

View file

@ -1,6 +1,6 @@
extends RefCounted
## The interface scale and the safe area (MobilePort, GameSettings, #35):
## * scale_for: phones about 1.6 (clamped to 1.8 for the smallest), iPads and desktop 1, the
## * scale_for: phones about 1.6 (clamped to 1.7 for the smallest), iPads and desktop 1, the
## same in portrait; a missing or impossible density falls back to the size class.
## * ui_scale: 1 on desktop whatever the Interface size; on a phone, the screen's scale times
## the Interface size (clamped to 0.8-1.3). The desktop preview plays a phone or an iPad by
@ -61,8 +61,8 @@ func _devices() -> void:
# name, pixels, dpi, px/pt, low, high
["iPhone 15", Vector2(2556, 1179), 460.0, 3.0, 1.6, 1.75],
["iPhone 15 Pro Max", Vector2(2796, 1290), 460.0, 3.0, 1.5, 1.6],
["iPhone 13 mini", Vector2(2340, 1080), 476.0, 3.0, 1.8, 1.8],
["iPhone SE", Vector2(1334, 750), 326.0, 2.0, 1.8, 1.8],
["iPhone 13 mini", Vector2(2340, 1080), 476.0, 3.0, 1.7, 1.7],
["iPhone SE", Vector2(1334, 750), 326.0, 2.0, 1.7, 1.7],
["iPad (10th)", Vector2(2360, 1640), 264.0, 2.0, 1.0, 1.0],
["iPad mini", Vector2(2266, 1488), 326.0, 2.0, 1.0, 1.0],
["iPad Pro 13\"", Vector2(2752, 2064), 264.0, 2.0, 1.0, 1.0],