builtin macro
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::editor::EditorState;
|
||||
use crate::menu::{MenuItem, MenuKey};
|
||||
use crate::mode::PendingMode;
|
||||
use kiln_core::{Archetype, Direction, SpinDirection};
|
||||
use kiln_core::{Archetype, Builtin};
|
||||
|
||||
/// One level in the editor's sidebar menu tree.
|
||||
///
|
||||
@@ -80,29 +80,29 @@ impl MenuLevel {
|
||||
MenuLevel::Machines => vec![
|
||||
MenuEntry::item('p', "Pushers...", |ed| ed.menu.push(MenuLevel::Pushers)),
|
||||
MenuEntry::item('s', "/ CW spinner", |ed| {
|
||||
ed.set_current(Archetype::Spinner(SpinDirection::Clockwise))
|
||||
ed.set_current(Archetype::Builtin(Builtin::Spinner, "spinner_cw"))
|
||||
}),
|
||||
MenuEntry::item('c', "\\ CCW spinner", |ed| {
|
||||
ed.set_current(Archetype::Spinner(SpinDirection::CounterClockwise))
|
||||
ed.set_current(Archetype::Builtin(Builtin::Spinner, "spinner_ccw"))
|
||||
}),
|
||||
],
|
||||
MenuLevel::Pushers => vec![
|
||||
MenuEntry::item('n', "▲ Pusher", |ed| {
|
||||
ed.set_current(Archetype::Pusher(Direction::North))
|
||||
ed.set_current(Archetype::Builtin(Builtin::Pusher, "pusher_north"))
|
||||
}),
|
||||
MenuEntry::item('s', "▼ Pusher", |ed| {
|
||||
ed.set_current(Archetype::Pusher(Direction::South))
|
||||
ed.set_current(Archetype::Builtin(Builtin::Pusher, "pusher_south"))
|
||||
}),
|
||||
MenuEntry::item('e', "► Pusher", |ed| {
|
||||
ed.set_current(Archetype::Pusher(Direction::East))
|
||||
ed.set_current(Archetype::Builtin(Builtin::Pusher, "pusher_east"))
|
||||
}),
|
||||
MenuEntry::item('w', "◄ Pusher", |ed| {
|
||||
ed.set_current(Archetype::Pusher(Direction::West))
|
||||
ed.set_current(Archetype::Builtin(Builtin::Pusher, "pusher_west"))
|
||||
}),
|
||||
],
|
||||
MenuLevel::Items => vec![MenuEntry::item('t', "♦ Gem", |ed| {
|
||||
// gem and glyph start with the same letter
|
||||
ed.set_current(Archetype::Gem)
|
||||
// 't' for 'treasure' — 'g' conflicts with glyph picker
|
||||
ed.set_current(Archetype::Builtin(Builtin::Gem, "gem"))
|
||||
})],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//! never mutates game state.
|
||||
|
||||
use crate::utils::rgba8_to_color;
|
||||
use kiln_core::Archetype;
|
||||
use kiln_core::{Archetype, Builtin};
|
||||
use kiln_core::cp437::tile_to_char;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
@@ -54,7 +54,7 @@ impl Widget for StatusSidebarWidget {
|
||||
|
||||
// Draw the gem indicator from the gem archetype's default glyph, so the
|
||||
// sidebar matches what gems look like on the board (no hardcoded ♦/color).
|
||||
let gem_glyph = Archetype::Gem.default_glyph();
|
||||
let gem_glyph = Archetype::Builtin(Builtin::Gem, "gem").default_glyph();
|
||||
let gem_char = tile_to_char(gem_glyph.tile).to_string();
|
||||
let gem_style = Style::default().fg(rgba8_to_color(gem_glyph.fg));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user