more editor menus
This commit is contained in:
@@ -226,6 +226,11 @@ impl EditorState {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_current(&mut self, archetype: Archetype) {
|
||||||
|
self.current_archetype = archetype;
|
||||||
|
self.current_glyph = self.current_archetype.default_glyph();
|
||||||
|
}
|
||||||
|
|
||||||
/// Stamps the current drawing thing (archetype + glyph) into the cell under the
|
/// Stamps the current drawing thing (archetype + glyph) into the cell under the
|
||||||
/// cursor, applying the placement rules (see [`Board::place_archetype`]).
|
/// cursor, applying the placement rules (see [`Board::place_archetype`]).
|
||||||
pub(crate) fn place_current(&mut self) {
|
pub(crate) fn place_current(&mut self) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use kiln_core::{Archetype, Direction};
|
||||||
use crate::editor::EditorState;
|
use crate::editor::EditorState;
|
||||||
use crate::menu::{MenuItem, MenuKey};
|
use crate::menu::{MenuItem, MenuKey};
|
||||||
use crate::mode::PendingMode;
|
use crate::mode::PendingMode;
|
||||||
@@ -15,7 +16,13 @@ pub(crate) enum MenuLevel {
|
|||||||
/// Menu of world-related concerns: set name / entry board
|
/// Menu of world-related concerns: set name / entry board
|
||||||
World,
|
World,
|
||||||
/// Menu of floor options
|
/// Menu of floor options
|
||||||
Floor
|
Floor,
|
||||||
|
/// Normal things that go on a board: terrain
|
||||||
|
Terrain,
|
||||||
|
/// Things that do defined actions: machines
|
||||||
|
Machines,
|
||||||
|
/// Various directions of pushers
|
||||||
|
Pushers,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MenuLevel {
|
impl MenuLevel {
|
||||||
@@ -24,7 +31,10 @@ impl MenuLevel {
|
|||||||
match self {
|
match self {
|
||||||
MenuLevel::Main => "Main",
|
MenuLevel::Main => "Main",
|
||||||
MenuLevel::World => "World",
|
MenuLevel::World => "World",
|
||||||
MenuLevel::Floor => "Floor"
|
MenuLevel::Floor => "Floor",
|
||||||
|
MenuLevel::Terrain => "Terrain",
|
||||||
|
MenuLevel::Machines => "Machines",
|
||||||
|
MenuLevel::Pushers => "Pushers",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,6 +47,8 @@ impl MenuLevel {
|
|||||||
MenuEntry::item('b', "Boards...", |ed| ed.open_boards_dialog()),
|
MenuEntry::item('b', "Boards...", |ed| ed.open_boards_dialog()),
|
||||||
MenuEntry::Separator,
|
MenuEntry::Separator,
|
||||||
MenuEntry::item('f', "Floor", |ed| ed.menu.push(MenuLevel::Floor)),
|
MenuEntry::item('f', "Floor", |ed| ed.menu.push(MenuLevel::Floor)),
|
||||||
|
MenuEntry::item('t', "Terrain", |ed| ed.menu.push(MenuLevel::Terrain)),
|
||||||
|
MenuEntry::item('m', "Machines", |ed| ed.menu.push(MenuLevel::Machines)),
|
||||||
],
|
],
|
||||||
MenuLevel::World => vec![
|
MenuLevel::World => vec![
|
||||||
MenuEntry::item('n', "Name", |ed| ed.open_name_dialog()),
|
MenuEntry::item('n', "Name", |ed| ed.open_name_dialog()),
|
||||||
@@ -50,6 +62,22 @@ impl MenuLevel {
|
|||||||
MenuEntry::item('s', "Stone", |_| {}),
|
MenuEntry::item('s', "Stone", |_| {}),
|
||||||
MenuEntry::item('c', "Custom glyph [TODO]", |_| {}),
|
MenuEntry::item('c', "Custom glyph [TODO]", |_| {}),
|
||||||
],
|
],
|
||||||
|
MenuLevel::Terrain => vec![
|
||||||
|
MenuEntry::item('w', "Wall", |ed| ed.set_current(Archetype::Wall)),
|
||||||
|
MenuEntry::item('c', "■ Crate", |ed| ed.set_current(Archetype::Crate)),
|
||||||
|
MenuEntry::item('v', "↕ Crate", |ed| ed.set_current(Archetype::VCrate)),
|
||||||
|
MenuEntry::item('h', "↔ Crate", |ed| ed.set_current(Archetype::HCrate)),
|
||||||
|
|
||||||
|
],
|
||||||
|
MenuLevel::Machines => vec![
|
||||||
|
MenuEntry::item('p', "Pushers...", |ed| ed.menu.push(MenuLevel::Pushers)),
|
||||||
|
],
|
||||||
|
MenuLevel::Pushers => vec![
|
||||||
|
MenuEntry::item('n', "▲ Pusher", |ed| ed.set_current(Archetype::Pusher(Direction::North))),
|
||||||
|
MenuEntry::item('s', "▼ Pusher", |ed| ed.set_current(Archetype::Pusher(Direction::South))),
|
||||||
|
MenuEntry::item('e', "► Pusher", |ed| ed.set_current(Archetype::Pusher(Direction::East))),
|
||||||
|
MenuEntry::item('w', "◄ Pusher", |ed| ed.set_current(Archetype::Pusher(Direction::West))),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user