#35: interface scale, safe area, and the mobile test kit
MobilePort: ui_scale() (clampf(4.3 / the screen's shorter side in inches, 1, 1.8) times the
Interface size; 1 on desktop), a size-class fallback (below 500 pt = phone, 1.6) when the
density is 0 or implausible, safe_rect(ci) (the display's safe area mapped into ci's canvas
through the final transform), minimum_target() (44 pt in canvas pixels), and the `forced`
override for tests. The desktop preview (-- --mobile) plays the phone in the window:
--safe-area=l,t,r,b insets it, --dpi=N sets its density, and without --dpi a 16:9-or-wider
window is a 2.7 in phone (about 1.6x) and a squarer one a 6 in iPad (1x).
GameSettings: interface_size (0.8-1.3, saved under [touch]) and apply_scale(), which sets the
window's content_scale_factor (always 1 on desktop). PerfTest shows the screen, density, safe
area, and resulting scale, to check the density on a device.
Test kit: test_mobile (last in SUITES) runs game/tests/mobile/*_test.gd in name order and puts
the root window back between files; mobile/touch.gd sends touches through
Input.parse_input_event; scale_test covers phones, iPads, desktop, the safe rect, and the target;
sticks_test is the 8c81d81 driver's 24 checks. game/tools/capture_mobile.gd takes the phone
screenshots.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f0291133fd
commit
aee60b0ba2
14 changed files with 874 additions and 3 deletions
|
|
@ -4,7 +4,9 @@ extends CanvasLayer
|
|||
## late night on a phone (docs/ios-test-port.md). Over everything, top centre:
|
||||
## * Now, over the last second: FPS, the frame time (average and worst), the CPU time in
|
||||
## physics (the farm's tick, FarmSim.step, runs there) and in rendering, the GPU time to draw
|
||||
## the view, the enemies alive, the 3D view's render size, and the renderer and device.
|
||||
## the view, the enemies alive, the 3D view's render size, and the renderer and device. And
|
||||
## the screen as the device reports it (size, density, safe area) with the interface scale
|
||||
## that gives (MobilePort.describe), to check the density on a phone.
|
||||
## * This night, from its start to its end (then held until the next night): the frame time's
|
||||
## average, 99th percentile, and worst, the share of frames slower than 30 FPS, the peak
|
||||
## enemies alive, and how long it ran. Frames while paused aren't counted. Printed as one
|
||||
|
|
@ -145,6 +147,7 @@ func _refresh(now: int) -> void:
|
|||
roundi(_second_frames * 1000.0 / span), span / n, _second_worst, _second_physics / n, _second_physics_worst,
|
||||
_second_render_cpu / n, "%.1f ms" % gpu if gpu > 0.0 else "n/a", enemies, roundi(size_3d.x), roundi(size_3d.y),
|
||||
RenderingServer.get_current_rendering_method(), RenderingServer.get_current_rendering_driver_name(), OS.get_model_name()]
|
||||
_now.text += "\n" + MobilePort.describe() # the screen as the phone reports it, and the interface scale it gives
|
||||
if _in_night:
|
||||
_night.text = _describe_night("so far")
|
||||
_second_usec = now
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue