cleanup
This commit is contained in:
@@ -67,10 +67,12 @@ pub(crate) struct EditorState {
|
||||
/// Cursor position in board cells, clamped to the board bounds.
|
||||
cursor: (i32, i32),
|
||||
/// The archetype the drawing tools stamp on [`place_current`](EditorState::place_current).
|
||||
/// Defaults to [`Archetype::Wall`]; the UI to change it comes later.
|
||||
/// Defaults to [`Archetype::Wall`]; changed via the Terrain / Pushers menus
|
||||
/// ([`set_current`](EditorState::set_current)).
|
||||
current_archetype: Archetype,
|
||||
/// The glyph the drawing tools stamp. Starts as the current archetype's default
|
||||
/// glyph and is edited via the glyph picker (`g`).
|
||||
/// The glyph the drawing tools stamp. Reset to the current archetype's default
|
||||
/// whenever the archetype changes ([`set_current`](EditorState::set_current)), and
|
||||
/// overridable via the glyph picker (`g`).
|
||||
current_glyph: Glyph,
|
||||
/// Whether draw mode is on: when set, moving the cursor stamps the current thing
|
||||
/// into each newly-entered cell (as if `space` were pressed after the move).
|
||||
@@ -226,6 +228,9 @@ impl EditorState {
|
||||
));
|
||||
}
|
||||
|
||||
/// Sets the archetype the drawing tools stamp, resetting the drawing glyph to
|
||||
/// that archetype's default (the glyph picker `g` can then override it). Called by
|
||||
/// the Terrain / Pushers menu choices.
|
||||
pub(crate) fn set_current(&mut self, archetype: Archetype) {
|
||||
self.current_archetype = archetype;
|
||||
self.current_glyph = self.current_archetype.default_glyph();
|
||||
|
||||
@@ -6,9 +6,12 @@ use crate::mode::PendingMode;
|
||||
/// One level in the editor's sidebar menu tree.
|
||||
///
|
||||
/// The menu is a stack of levels (the current one is the stack's last element); a
|
||||
/// breadcrumb is built from their [`title`](MenuLevel::title)s. A choice either opens
|
||||
/// a [dialog](kiln_ui::dialog) or pushes a child level — e.g. [`Main`](MenuLevel::Main)
|
||||
/// descends into [`World`](MenuLevel::World) or [`Floor`](MenuLevel::Floor).
|
||||
/// breadcrumb is built from their [`title`](MenuLevel::title)s. A choice opens a
|
||||
/// [dialog](kiln_ui::dialog), pushes a child level (e.g. [`Main`](MenuLevel::Main)
|
||||
/// descends into [`World`](MenuLevel::World) or [`Terrain`](MenuLevel::Terrain)), or
|
||||
/// sets the drawing tools' current archetype (e.g. the [`Terrain`](MenuLevel::Terrain)
|
||||
/// and [`Pushers`](MenuLevel::Pushers) choices, via
|
||||
/// [`set_current`](EditorState::set_current)).
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub(crate) enum MenuLevel {
|
||||
/// The top-level main menu: switch boards, view scripts, more later
|
||||
|
||||
Reference in New Issue
Block a user