From e24326b735d3be785fbba7df47f36e985f8555c3 Mon Sep 17 00:00:00 2001 From: Jonas Reith Date: Mon, 31 Aug 2026 19:11:16 +0200 Subject: [PATCH] Add a Main Menu + save browser, replacing auto-generate and the one-slot save The app used to always generate a world straight from planet.cfg on launch and F5 always overwrote a single fixed planet.save. Now it opens on a full-screen Main Menu (Home / Settings / Load World) so every PlanetConfig field, the seed, starting a new world, and browsing saves are all reachable without hand-editing planet.cfg, and saves are timestamped so nothing is silently overwritten. A toolbar button reopens the menu later without disturbing a running world. The settings editor is generic (no per-field UI code): configFieldTable() reuses the existing CONFIG_FIELDS X-macro to build a runtime field table, grouped into 25 categories via an explicit name->category lookup (a "first field of each section" boundary scan was tried first and is wrong, since CONFIG_FIELDS emits all doubles, then all ints, then the seed -- not struct declaration order, so most categories aren't contiguous in that order). Save v25 adds the viewer's colour-mode/overlay state, kept out of Planet::writeState/readState's signature so it touches none of the existing headless tests. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01TMfyZv91tonDnPJqbaTVJE --- .gitignore | 2 +- BUILD.md | 45 +++--- CLAUDE.md | 88 ++++++++++-- CMakeLists.txt | 9 ++ src/render/MainMenu.cpp | 275 ++++++++++++++++++++++++++++++++++++ src/render/MainMenu.hpp | 35 +++++ src/render/Toolbar.cpp | 11 +- src/render/Viewer.cpp | 102 +++++++++++-- src/render/Viewer.hpp | 15 +- src/render/ViewerInput.cpp | 10 +- src/render/ViewerRender.cpp | 10 ++ src/sim/Planet.hpp | 16 +++ src/sim/PlanetIO.cpp | 201 ++++++++++++++++++++++++++ test_viewerstate.cpp | 80 +++++++++++ 14 files changed, 854 insertions(+), 45 deletions(-) create mode 100644 src/render/MainMenu.cpp create mode 100644 src/render/MainMenu.hpp create mode 100644 test_viewerstate.cpp diff --git a/.gitignore b/.gitignore index 6a03212..f1a29a3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ # Runtime-generated, machine-specific planet.cfg -planet.save +*.save screenshot*.png # Claude Code local (machine-specific) settings diff --git a/BUILD.md b/BUILD.md index ccd56fc..19ded52 100644 --- a/BUILD.md +++ b/BUILD.md @@ -72,7 +72,7 @@ the full ~2.8x speedup; the default uses all cores for no extra gain: F fast-forward Phase-1 forming to settled (instant) R reseed planet (restart forming) + / - subdivision level (detail), 1..7 - F5 / F9 save / load full state (planet.save) + F5 / F9 save / load full state (writes/reads a timestamped world_