playtest mode

This commit is contained in:
2026-06-20 19:05:46 -05:00
parent e7c3ca1139
commit d32914d99d
10 changed files with 168 additions and 9 deletions
+11
View File
@@ -4,6 +4,7 @@ use std::time::Duration;
use kiln_core::Board;
use kiln_core::game::GameState;
use crate::animation::Animation;
use crate::editor::EditorState;
use crate::log::LogState;
use crate::menu::{MenuItem, MenuCloseAnimation, MenuOpenAnimation, MenuState};
use crate::mode::{Mode, PendingMode};
@@ -35,6 +36,14 @@ pub(crate) struct Ui {
/// Set by a menu action to request a Play↔Edit switch; applied by the run loop
/// (which owns [`world_path`](Ui::world_path) and can run the world reload).
pub(crate) pending_mode: Option<PendingMode>,
/// The editor parked while a **playtest** runs. `Some` exactly while the current
/// [`Mode::Play`](crate::mode::Mode::Play) is a playtest launched from the editor
/// (see [`EditorState::playtest`]); the run loop restores it on exit. Doubles as
/// the "am I playtesting?" flag for `Esc` handling and the title cue.
pub(crate) suspended_editor: Option<EditorState>,
/// Set when `Esc` is pressed during a playtest, signalling the run loop to drop the
/// playtest game and restore [`suspended_editor`](Ui::suspended_editor).
pub(crate) exit_playtest: bool,
}
impl Default for Ui {
@@ -48,6 +57,8 @@ impl Default for Ui {
should_quit: false,
world_path: String::new(),
pending_mode: None,
suspended_editor: None,
exit_playtest: false,
}
}
}