summaryrefslogtreecommitdiff
path: root/src/scenes/zz_dump.rs
diff options
context:
space:
mode:
authorskylar <me@casper>2026-11-11 15:24:37 -0800
committerskylar <me@casper>2026-11-11 15:24:37 -0800
commit9ccf951473e21a8b90c25161156fa09a9b227a7b (patch)
treee7bd9858a4cdbc5ae50069db8ca0cf868e436dec /src/scenes/zz_dump.rs
parentd36c54d996f3c14ae811312dbbe621e12a39edde (diff)
Orrery 0.1.0: the galaxy, flight, cities, inventory and saves
Grows the derelict crawler into the whole game, and gets it ready to publish. - A galaxy of star systems joined by lanes, split between four peoples' territories, with a star map and a system map. Systems are modelled with Kepler orbits, moons inside their Hill spheres, belts past the frost line and stations at Lagrange points. - Flight around one place at a time: arcade flight with a throttle fallback where held keys can't be detected, mining rocks for ore, landing, docking at stations, and boarding wrecks that come and go by the calendar. - Your ship to walk about, and capital cities to land at: generated plans with walls, quarters and streets, building interiors, shops, taverns, scholars and armourers. - Fighting with a weapon and a gun ready, six damage types and how each monster takes them, and armour that guards, wears and can be mended. - Everything you own has a weight: a vim-keyed inventory, a pack and the ship's lockers, and trade in ore, salvage, arms and fuel. - Characters with a people and a ship of their own, saved as versioned JSON on every scene change and on quit, with a character sheet, a saves list and a pause menu wherever you are. - `orrery weapons`, `armour`, `galaxy`, `system` and `town` print the generators' output without the TUI. - Release: README install steps for macOS and Linux, a Makefile whose install also works with macOS's install, an MIT licence, and Cargo metadata with rust-version 1.88. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/scenes/zz_dump.rs')
-rw-r--r--src/scenes/zz_dump.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/scenes/zz_dump.rs b/src/scenes/zz_dump.rs
new file mode 100644
index 0000000..241f342
--- /dev/null
+++ b/src/scenes/zz_dump.rs
@@ -0,0 +1,62 @@
+//! Temporary: prints screens for a UI review.
+use super::tests::test_ctx;
+use super::*;
+use ratatui::Terminal;
+use ratatui::backend::TestBackend;
+use ratatui::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
+
+fn show(name: &str, scene: &dyn Scene, ctx: &Ctx, w: u16, h: u16) {
+ let mut t = Terminal::new(TestBackend::new(w, h)).unwrap();
+ t.draw(|f| scene.render(f, ctx)).unwrap();
+ let b = t.backend().buffer();
+ let cells: Vec<&str> = b.content.iter().map(|c| c.symbol()).collect();
+ println!("===== {name} ({w}x{h})");
+ for row in cells.chunks(w as usize) {
+ println!("{}", row.concat().trim_end());
+ }
+}
+fn k(s: &mut dyn Scene, ctx: &mut Ctx, c: KeyCode) {
+ s.key(KeyEvent::new(c, KeyModifiers::NONE), ctx);
+}
+
+#[test]
+fn zz_dump() {
+ let mut ctx = test_ctx();
+ let dir = crate::save::scratch("dump");
+ ctx.saves = Some(dir.clone());
+ ctx.slot = Some(crate::save::new_slot(&dir, &ctx.character, ctx.seed));
+ ctx.autosave();
+ let (w, h) = (120, 40);
+ show("title", &title::Title::new(&ctx), &ctx, w, h);
+ show("create", &character::Create::new(&ctx), &ctx, w, h);
+ show("sheet", &character::Sheet::new(), &ctx, w, h);
+ show("saves", &saves::Saves::new(&ctx), &ctx, w, h);
+ show("forge", &forge::Forge::new(&ctx), &ctx, w, h);
+ let home = ctx.system.home_place();
+ let mut a = aboard::Aboard::landed(&ctx, home);
+ show("aboard", &a, &ctx, w, h);
+ k(&mut a, &mut ctx, KeyCode::Esc);
+ show("aboard pause", &a, &ctx, w, h);
+ let mut a = aboard::Aboard::landed(&ctx, home);
+ k(&mut a, &mut ctx, KeyCode::Char('i'));
+ show("aboard inv", &a, &ctx, w, h);
+ let mut t = town::TownScene::new(&ctx, home);
+ show("town", &t, &ctx, w, h);
+ k(&mut t, &mut ctx, KeyCode::Char('m'));
+ show("town map", &t, &ctx, w, h);
+ let mut f = flight::FlightScene::new(&ctx);
+ show("flight", &f, &ctx, w, h);
+ show("flight narrow", &f, &ctx, 80, 24);
+ show("aboard 80", &aboard::Aboard::landed(&ctx, home), &ctx, 80, 24);
+ show("derelict 80", &derelict::Derelict::new(2), &ctx, 80, 24);
+ k(&mut f, &mut ctx, KeyCode::Esc);
+ show("flight pause", &f, &ctx, w, h);
+ show("system map", &system_map::SystemMap::new(&ctx), &ctx, w, h);
+ show("galaxy map", &galaxy_map::GalaxyMap::new(&ctx), &ctx, w, h);
+ show("port station", &port::Port::new(&ctx, 0), &ctx, w, h);
+ let mut d = derelict::Derelict::board(2, &mut ctx);
+ show("derelict", &d, &ctx, w, h);
+ k(&mut d, &mut ctx, KeyCode::Char('f'));
+ show("derelict aim", &d, &ctx, w, h);
+ let _ = std::fs::remove_dir_all(dir);
+}