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

@ -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: