View the complete source on GitHub ↗
Central object Create the adapter gdscript const GuaAutoAdapterScript := preload(
"res://addons/gua/gua_auto_adapter.gd"
)
var ui := GuaAutoAdapterScript.new()ui is the boundary between the Godot Control tree and the Gua runtime. Pass the root to attach, then call update as frames advance.
Top-level variables Name Type / default Purpose start_inspector_bridge_on_readybool / true Whether to start the in-game WebSocket bridge from _ready. inspector_bridge_portint / 8765 The port used by Inspector and MCP. GUA_BRIDGE_PORT can override it. uiGuaAutoAdapter Collects Controls, dispatches requests, and publishes snapshots. loadingbool / false Selects the logical title or loading screen. title_labelLabel The title heading, reflected as a semantic text node. start_buttonButton The primary action; its pressed signal calls _show_loading. settings_buttonButton A second button used to demonstrate collection of multiple actions. loading_labelLabel The loading text revealed after the start action. visual_e2ebool Enabled by GUA_VISUAL_E2E=1 to add visual-test controls and capture. v2_e2ebool Enabled by GUA_V2_E2E=1 to add protocol-v2 form fixtures. visual_e2e_update_elapsedfloat / 0.0 Throttles visual-E2E updates to roughly 0.1-second intervals.
Lifecycle functions Function When Gua responsibility _ready()Scene ready Reads environment, builds UI, attaches the adapter, publishes once, and starts the bridge. _process(delta)Every frame Calls ui.update(_current_screen()) with the latest Control state. _current_screen()Before update Maps loading to the logical screen name title or loading.
UI construction and operations Function Purpose _build_ui()Creates the normal Labels and Buttons, including layout and signals. _build_visual_e2e_controls()Adds a sensitive LineEdit, CheckBox, and OptionButton for visual comparison and redaction tests. _build_v2_e2e_controls()Adds TextEdit, selection, tab, and scroll targets for protocol-v2 operations. _show_loading()Updates visibility and enabled state after start, then publishes immediately. _capture_visual_e2e()Waits for rendered frames, then explicitly publishes a viewport PNG. _start_inspector_bridge()Starts the in-game bridge and prints either its URL or an actionable warning.
✓ gua_id and gua_sensitive set_meta("gua_id", ...) supplies a stable ID independent of NodePath. set_meta("gua_sensitive", true) prevents values from appearing in snapshots and diagnostics. It does not automatically mask pixels already rendered into a PNG.