Self test opens the bestiary too; bestiary screenshot with the portraits

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-08 01:12:33 +01:00
1 parent 918458df50
commit 6886b2e1a4
4 files changed
+10 -4

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

+6 -1
View File
@@ -2188,7 +2188,7 @@ app.pending_briefing = briefing_of(&campaign, i);
} }
} }
// ---- self test and screenshots (desktop): DC_SHOT=demo, title or a savegame file starts it right // ---- self test and screenshots (desktop): DC_SHOT=demo, title, bestiary or a savegame file starts it right
// away, DC_SHOT_STYLE=hd|pixel picks the graphics style (not saved), DC_SHOT_AFTER seconds later // away, DC_SHOT_STYLE=hd|pixel picks the graphics style (not saved), DC_SHOT_AFTER seconds later
// (default 10) the screen goes to DC_SHOT_OUT (default /tmp/dc-shot.png) and the game ends; // (default 10) the screen goes to DC_SHOT_OUT (default /tmp/dc-shot.png) and the game ends;
// DC_SHOT_ZOOM sets the camera zoom, DC_SHOT_YAW its turn, DC_SHOT_AT=x,z where it looks; // DC_SHOT_ZOOM sets the camera zoom, DC_SHOT_YAW its turn, DC_SHOT_AT=x,z where it looks;
@@ -2247,6 +2247,11 @@ impl ShotPlan {
self.started = Some(now); self.started = Some(now);
return None; return None;
} }
if self.load == "bestiary" {
menu.open_bestiary(true);
self.started = Some(now);
return None;
}
if self.load == "demo" { if self.load == "demo" {
app.seed = next_seed(app.seed); app.seed = next_seed(app.seed);
(app.game, app.cam) = Game::new_demo_map(app.seed); (app.game, app.cam) = Game::new_demo_map(app.seed);
+1 -1
View File
@@ -67,7 +67,7 @@ fn max_level(e: Entry) -> u32 {
} }
impl Menu { impl Menu {
pub(super) fn open_bestiary(&mut self, from_title: bool) { pub(crate) fn open_bestiary(&mut self, from_title: bool) {
self.page = Some(Page::Bestiary { tab: 0, sel: 1, level: 1, from_title }); self.page = Some(Page::Bestiary { tab: 0, sel: 1, level: 1, from_title });
self.scroll = 0; self.scroll = 0;
} }
+3 -2
View File
@@ -5,7 +5,8 @@
2. `cargo build --profile desktop` 2. `cargo build --profile desktop`
3. `python3 tools/shots_desktop.py [--style hd|pixel] [names...]` runs the game once per scene with 3. `python3 tools/shots_desktop.py [--style hd|pixel] [names...]` runs the game once per scene with
DC_SHOT (see the self test in src/main.rs), makes its window float at 1280x800 (Hyprland), and DC_SHOT (see the self test in src/main.rs), makes its window float at 1280x800 (Hyprland), and
writes docs/screenshots/<name>.png scaled to 1280x800. `title` is the title screen. writes docs/screenshots/<name>.png scaled to 1280x800. `title` is the title screen,
`bestiary` the bestiary.
Needs Pillow (for the scaling) and Hyprland's hyprctl. Needs Pillow (for the scaling) and Hyprland's hyprctl.
""" """
import json, os, subprocess, sys, time import json, os, subprocess, sys, time
@@ -29,7 +30,7 @@ def window_to_1280x800():
def shot(name, style, after=8): def shot(name, style, after=8):
out = f"/tmp/shot-{name}.png" out = f"/tmp/shot-{name}.png"
env = dict(os.environ, DC_SHOT="title" if name == "title" else f"/tmp/scenes/{name}.json", env = dict(os.environ, DC_SHOT=name if name in ("title", "bestiary") else f"/tmp/scenes/{name}.json",
DC_SHOT_STYLE=style, DC_SHOT_AFTER=str(after), DC_SHOT_OUT=out) DC_SHOT_STYLE=style, DC_SHOT_AFTER=str(after), DC_SHOT_OUT=out)
p = subprocess.Popen([GAME], env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) p = subprocess.Popen([GAME], env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
window_to_1280x800() window_to_1280x800()