extends SceneTree ## One photograph of every main-menu screen, including the lobby. ## ## godot --path . --windowed --resolution 1280x720 \ ## -s res://debug/menu_capture.gd -- ## ## The lobby is the reason this exists. It only appears after hosting, so it is ## the screen least likely to be looked at and the one where an unstyled list or ## a collapsed card would sit unnoticed — which is exactly the class of defect ## that this project keeps finding by LOOKING rather than by asserting. const MENU := "res://ui/main_menu/main_menu.tscn" var _out := "." func _initialize() -> void: var args := OS.get_cmdline_user_args() if args.size() > 0: _out = String(args[0]) _run() func _run() -> void: await process_frame change_scene_to_file(MENU) for _i in 60: await process_frame var menu := current_scene if menu == null: print("menu_capture: no menu") quit(1) return await _shot("home") menu._show(menu.LEVELS) await _shot("levels") menu._show(menu.MULTIPLAYER) await _shot("multiplayer") # Host for real, so the lobby is photographed in the state a player reaches # it in — host controls enabled, own name in the list — rather than in an # empty one that would hide a broken player list. var nm = root.get_node_or_null("NetworkManager") if nm and nm.host_game() == OK: menu._on_connection_succeeded() for _i in 20: await process_frame await _shot("lobby") nm.disconnect_game() else: print("menu_capture: could not host, lobby not shot") quit(0) func _shot(tag: String) -> void: for _i in 12: await process_frame root.get_texture().get_image().save_png("%s/menu_%s.png" % [_out, tag]) print("menu_capture: saved ", tag)