Files
tidewall/test/capture/menu_scene.gd
T
claudeandClaude Opus 5.5 c504551b28 A10: Menus and settings
The game now opens on a main menu when it has a window: practice
against bots (count and skill), join a server (by address, or from a
LAN search list), settings, and quit. In a match, Escape brings up a
pause menu (the match goes on) with settings and leave; when a match
the player was in ends, a results screen shows their place,
eliminations and the last of the feed.

- KeyBindings: every action rebindable to a key or mouse button.
  bind() refuses an input another action uses and names it; Escape is
  reserved. ClientInput reads keys through the bindings.
- GameSettings: bindings, mouse, graphics (quality preset and the
  print pass), audio (master, music and effects buses), display
  (window mode, vsync, frame cap), name, last server and practice
  choices, saved in user://settings.cfg. Missing, unreadable or
  corrupt files and bad values fall back to defaults, value by value;
  hand-edited key clashes are repaired on load.
- Menus (src/ui): paper-and-ink panels, brass focus edge, keyboard
  navigable; a drawn sea-and-tide-post backdrop, or an ink wash over
  a match. AppShell runs menus and the session.
- LocalServer takes a bot difficulty.
- make menu-captures renders every screen.

Closes #50

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 11:30:09 -05:00

38 lines
1.6 KiB
GDScript

## Capture scenario for the menus (A10): one screen of Menus, as a player would first see
## it, with default settings and nothing saved. `screen` is one of Menus.SCREENS; the
## join screen lists two made-up servers, and the results screen a made-up finish.
## `over_match` puts the ink wash over a plain stand-in for a match instead of the
## backdrop.
extends Control
@export var screen: String = "main"
@export var over_match: bool = false
@export var settings_tab: int = 0
func _ready() -> void:
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
if over_match:
var stand_in: MenuBackdrop = MenuBackdrop.new()
stand_in.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
add_child(stand_in)
var menus: Menus = Menus.new()
menus.use_settings(GameSettings.new(), "user://capture_unsaved.cfg")
add_child(menus)
menus.over_match = over_match
match screen:
"join":
menus.show_screen("join", false)
menus.show_servers([
{"name": "Harbour Lights", "players": 11, "max_players": 24, "address": "192.0.2.10", "port": 24650, "source": "lan", "compatible": true},
{"name": "Saltmarsh", "players": 2, "max_players": 24, "address": "192.0.2.11", "port": 24650, "source": "list", "compatible": true},
{"name": "Old Pier", "players": 0, "max_players": 24, "address": "192.0.2.12", "port": 24650, "source": "lan", "compatible": false},
] as Array[Dictionary])
"results":
menus.show_results(3, 24, 4, ["Ada drowned", "You took Thole with a dock carbine", "Gannet fell"] as Array[String])
"settings":
menus.show_screen("settings", false)
menus._tabs.current_tab = settings_tab
_:
menus.show_screen(screen, false)