glyph picker

This commit is contained in:
2026-06-20 15:27:09 -05:00
parent e74d015d1b
commit 05142e5712
12 changed files with 638 additions and 26 deletions
+10 -5
View File
@@ -5,10 +5,9 @@
//! (or HJKL). There is no editor — this is a play-only front-end.
//!
//! Rendering is text-based: kiln's bitmap-font tile indices are reinterpreted
//! as characters (see [`cp437`]) and drawn with each cell's RGB colors.
//! as characters (see [`kiln_core::cp437`]) and drawn with each cell's RGB colors.
mod animation;
mod cp437;
mod editor;
mod input;
mod log;
@@ -25,7 +24,10 @@ mod utils;
mod editor_menu;
use crate::animation::{AnimWidget, AnimationLayer};
use crate::editor::{EditorState, draw_editor, handle_code_editor_input, handle_dialog_input};
use crate::editor::{
EditorState, draw_editor, handle_code_editor_input, handle_dialog_input,
handle_glyph_dialog_input,
};
use crate::input::{
InputMode, current_input_mode, handle_board_input, handle_editor_input, handle_menu_input,
handle_scroll_input,
@@ -170,6 +172,7 @@ fn run(terminal: &mut ratatui::DefaultTerminal, mode: &mut Mode, ui: &mut Ui) ->
Mode::Edit(ed) => match input_mode {
InputMode::Editor => handle_editor_input(event, size.width, ed, ui),
InputMode::Dialog => handle_dialog_input(event, ed),
InputMode::GlyphDialog => handle_glyph_dialog_input(event, ed),
InputMode::CodeEditor => handle_code_editor_input(event, ed),
_ => unreachable!(
"Menu and Ignore handled above; Board/Scroll/Frozen input modes only occur in Play mode"
@@ -263,9 +266,11 @@ fn draw(frame: &mut Frame, mode: &mut Mode, ui: &mut Ui) {
);
}
}
// The dialog overlay only exists while editing.
// The dialog / glyph-picker overlays only exist while editing.
Mode::Edit(ed) => {
if let Some(d) = &ed.dialog {
if let Some(g) = &ed.glyph_dialog {
g.draw(frame);
} else if let Some(d) = &ed.dialog {
d.draw(frame);
}
}