Add Alt+F to toggle fullscreen and window mode

New remappable action `toggle_fullscreen` (Alt+F) handled in main.gd::_input(),
so it works in the menu, during a match with the pointer captured and in the boss
sandbox; the event is marked handled so the key does not reach the rest of the game.

toggle_fullscreen() switches between WINDOW_MODE_FULLSCREEN and WINDOW_MODE_WINDOWED;
the state lives in main.fullscreen (initialised from the real window mode) instead of
querying the driver on every press, so the toggle is deterministic and testable. On
Web it is a no-op because fullscreen belongs to the page.

Desktop HUD hint updated. New tools/test_fullscreen_shortcut.gd: 8 checks (action and
key mapping, alternation, bare F inert, works mid-match without freeing the cursor).
Verified on a real display: window_get_mode 0 -> 3 -> 0.
This commit is contained in:
enne2
2026-10-24 12:55:15 +02:00
parent cb14fd5400
commit 4af402f8bf
6 changed files with 138 additions and 1 deletions
+16
View File
@@ -51,9 +51,24 @@ sulla schermata iniziale e i pulsanti non erano cliccabili.
| `scripts/start_screen.gd` | campo del nome sempre mostrato e vuoto, `reset_for_new_player()`, `GIOCA` bloccato a campo vuoto |
| `scripts/main.gd` | `start_game()` deriva id e record dal nome e chiama `player.begin_play()`; `_on_player_died()` sblocca il profilo e invia il nome della partita conclusa |
| `scripts/player.gd` | cursore visibile al menu, `begin_play()` con la cattura, flag `playing` |
| `scripts/game_hud.gd` | promemoria dei comandi desktop aggiornato con `Alt+F` |
| `tools/test_player_profile.gd` | 30 controlli (campo libero, id derivato, record per nome, game over) |
| `tools/test_start_screen.gd` | 15 controlli (campo sempre richiesto, partenza bloccata a campo vuoto, campo liberato dopo il game over, cursore libero al menu e catturato solo in partita) |
## 1c. Scorciatoia Alt+F (finestra / schermo intero)
* Azione in `project.godot`: `toggle_fullscreen` = `Alt+F` (rimappabile dal pannello
Input Map come le altre).
* Gestita in `main.gd::_input()`, quindi vale **sempre**: menu, partita (anche con il
cursore catturato) e sandbox del boss. L'evento viene marcato come gestito, così il
tasto non arriva al resto del gioco.
* `main.gd::toggle_fullscreen()` alterna `WINDOW_MODE_FULLSCREEN` e
`WINDOW_MODE_WINDOWED`; lo stato vive in `main.fullscreen`, inizializzato dalla
modalità reale della finestra. Nel browser non fa nulla (il fullscreen è della pagina).
* Verificato su display reale: `window_get_mode` 0 (finestra) → 3 (schermo intero) → 0.
* `tools/test_fullscreen_shortcut.gd`: 8 controlli (azione e tasto mappati, alternanza,
F da solo inerte, funzionamento in partita senza liberare il cursore).
## 2. Verifiche eseguite
```bash
@@ -66,6 +81,7 @@ G="$HOME/.local/opt/godot-4.7.1/Godot_v4.7.1-stable_linux.x86_64"
"$G" --headless --path . --script res://tools/test_spawn_windows.gd
"$G" --headless --path . --script res://tools/test_wave_growth.gd
"$G" --headless --path . --script res://tools/test_gameplay_improvements.gd
"$G" --headless --path . --script res://tools/test_fullscreen_shortcut.gd # 8/8 PASS
python3 tools/test_scores_api.py # 42/42
```