prototype
MAmattpocock/skills337k4,978 new stars in the last 7 days
Engine-neutral design rules for game HUDs and menus: anchors and containers, scaling, safe areas, gamepad focus, HUDs driven by events instead of polling, and accessibility minimums. Use for menus, health bars or inventory screens that break on ultrawide or phones. Pair with `godot-ui-control` or `roblox-ui`. Not for button juice (`game-feel`) or rebinding (`input-systems`).
Make every HUD and menu work on a phone, an ultrawide monitor and a TV, with a mouse or only a gamepad. This skill decides layout, scaling, focus, screen flow and how UI listens to game state; the engine UI skill supplies nodes, components and styling.
Not this skill: widget APIs and themes (godot-ui-control, roblox-ui, Unity UGUI or UI
Toolkit through the Unity skills), visual juice (game-feel), conversation flow and choice
logic (dialogue-systems), rebinding screens' input logic (input-systems), UI art and icons
(create-game-assets).
(x, y) is correct at one resolution only.expand and anchor HUD corners outward (default), or
letterbox when the design truly needs a fixed frame.health_changed, score_changed; set the initial
value once on connect, because signals do not replay.get_viewport().gui_get_focus_owner() (Godot) or
EventSystem.current.currentSelectedGameObject (Unity) is null.--resolution WxH; needs a
display or xvfb-run, because the headless renderer draws nothing) and save a viewport
screenshot at each. Inspect them for clipped or overlapping elements.# Godot 4.7. Anchor the score to a corner; an HBoxContainer spaces the hearts.
func _ready() -> void:
$Score.set_anchors_preset(Control.PRESET_TOP_LEFT)
for i in lives:
$Hearts.add_child(make_heart())
Unity UGUI: anchor the RectTransform to the corner and use a HorizontalLayoutGroup; set the
pivot to the same corner, or the element grows in every direction when its size changes.
Godot 4.7 project.godot [display]:
window/stretch/mode="canvas_items" window/stretch/aspect="expand"
window/size/viewport_width=1920 window/size/viewport_height=1080
Unity 6.3 CanvasScaler: Scale With Screen Size, Reference Resolution 1920x1080,
Match Width Or Height = 0.5 (1.0 if the layout must never clip vertically)
Unity 6.3 UI Toolkit: the same three settings live on the PanelSettings asset
# Godot 4.7. Only Android and iOS report a real safe area; elsewhere the call returns the usable
# screen rect (taskbar, menu bar or dock excluded), which would inset a fullscreen HUD.
func _apply_safe_area() -> void:
if not OS.has_feature("mobile"):
return
var safe := Rect2(DisplayServer.get_display_safe_area()) # screen pixels
var win := Rect2(Rect2i(DisplayServer.window_get_position(), DisplayServer.window_get_size()))
var inner := safe.intersection(win)
var to_ui := get_viewport_rect().size / win.size # window pixels -> UI units under stretch
$Margin.add_theme_constant_override("margin_left", int((inner.position.x - win.position.x) * to_ui.x))
$Margin.add_theme_constant_override("margin_top", int((inner.position.y - win.position.y) * to_ui.y))
$Margin.add_theme_constant_override("margin_right", int((win.end.x - inner.end.x) * to_ui.x))
$Margin.add_theme_constant_override("margin_bottom", int((win.end.y - inner.end.y) * to_ui.y))
Unity: read Screen.safeArea and set a panel's anchorMin/anchorMax to its corners divided
by Screen.width/Screen.height; recompute when the rect changes, not every frame.
# Godot 4.7. Focus something on open; fix neighbours only where the automatic guess is wrong.
func _on_screen_shown() -> void:
$PlayButton.grab_focus()
$PlayButton.focus_neighbor_bottom = $SettingsButton.get_path()
$SettingsButton.focus_neighbor_top = $PlayButton.get_path()
Unity UGUI: EventSystem.current.SetSelectedGameObject(playButton) in OnEnable, with
Navigation set to Automatic or Explicit. UI Toolkit: call Focus() on the first element.
# RIGHT: HUD reacts to a signal; it updates only when health actually changes.
func _ready() -> void:
player.health_changed.connect(_on_health_changed) # emitted by gameplay
_on_health_changed(player.hp, player.max_hp) # signals do not replay initial state
func _on_health_changed(current: int, max_health: int) -> void:
# ratio maps 0..1 to the bar's configured range (default value range is 0..100).
$HealthBar.ratio = clampf(float(current) / max_health, 0.0, 1.0) if max_health > 0 else 0.0
# WRONG: func _process(dt): $HealthBar.value = player.hp / player.max_hp # polls every frame,
# couples UI to the player's internals, and runs work even when nothing changed.
focus_behavior_recursive and mouse_behavior_recursive).set_process_input(false) does not disable a Godot menu: buttons receive GUI input, not
_input. Use the recursive focus and mouse behaviours above.StandaloneInputModule. Replace it with
InputSystemUIInputModule. UI Toolkit reads the project-wide UI actions and needs no module.window/stretch/scale_mode="integer"; Unity: pick a reference resolution that divides the
target displays evenly and use a pixel-perfect canvas.tr(), Unity Localization) and containers that size to content.is_paused, in_settings, confirm_open) breaks on the third
overlay. Use the screen stack.get_tree().paused = true and the overlay's
process_mode = PROCESS_MODE_ALWAYS; Unity: menu animation must use unscaled time when
pausing by Time.timeScale = 0.references/layout-and-flow.md: read for per-engine stretch and scale settings, safe-area
maths, the full focus-trap and screen-stack code, diegetic vs world-space UI, accessibility
details and localization-ready layout.godot-ui-control, roblox-ui: engine widgets, themes and styling; load alongside this one.game-feel: button pops, transitions and HUD juice on top of this layout.dialogue-systems: conversation and choice logic inside this UI shell.input-systems: device switching and rebinding screens.Last verified: 2026-11-30.
Control.focus_behavior_recursive/mouse_behavior_recursive (added in 4.5),
DisplayServer.get_display_safe_area(); stretch settings per
https://docs.godotengine.org/en/4.7/tutorials/rendering/multiple_resolutions.html.InputSystemUIInputModule replaces StandaloneInputModule
(https://docs.unity3d.com/Packages/[email protected]/manual/UISupport.html;
https://packages.unity.com/com.unity.inputsystem).MAmattpocock/skills337k4,978 new stars in the last 7 days
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
FIfirecrawl/firecrawl215k5,595 new stars in the last 7 days
Apply color and font themes to slides, docs and web pages, with 10 built-in themes.
ANanthropics/skills203k3,265 new stars in the last 7 days
Set visual direction and typography for UI, avoiding templated defaults.
ANanthropics/skills203k3,265 new stars in the last 7 days
Build complex HTML artifacts with React, Tailwind CSS, state management and routing.
ANanthropics/skills203k3,265 new stars in the last 7 days