window/fit_vs_fill¶
Goal¶
Compare FIT vs FILL viewport modes and understand letterbox vs crop tradeoffs.
Why this tutorial exists¶
This is a core decision for any game:
preserve full virtual frame (
FIT)or fill full window without bars (
FILL)
Source map¶
Settings profile:
examples/settings/window/fit_vs_fill.ymlExample builder:
examples/catalog/window/fit_vs_fill/main.pyScene:
examples/catalog/window/fit_vs_fill/scenes/scene.pyViewport mode enum:
packages/mini-arcade-core/src/mini_arcade_core/engine/render/viewport.py
Runtime flow¶
set_viewport_mode(...) updates Viewport.mode, then recomputes:
scaleviewport_w/viewport_hoffset_x/offset_y
The tutorial visualizes:
full virtual border
currently visible virtual bounds
So cropping in FILL is explicit.
What to verify¶
1(FIT) shows all virtual edges, with bars if needed.2(FILL) removes bars but crops top/bottom or left/right.visible virtual boundsshrink inFILL.offsetcan become negative inFILLmode.
Run¶
mini-arcade run --example window/fit_vs_fill
mini-arcade run --example window/fit_vs_fill --pass-through --backend native
Controls¶
1->FIT2->FILLF1-> debug overlayESC-> quit
Next step¶
Build resize-responsive layout: resize_reflow.md