diff --git a/Cargo.lock b/Cargo.lock index 5833ac3..cbd64db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -934,7 +934,7 @@ dependencies = [ [[package]] name = "tengri" -version = "0.3.4" +version = "0.4.0" dependencies = [ "tengri_dsl", "tengri_input", @@ -944,7 +944,7 @@ dependencies = [ [[package]] name = "tengri_dsl" -version = "0.3.4" +version = "0.4.0" dependencies = [ "itertools 0.14.0", "konst", @@ -955,7 +955,7 @@ dependencies = [ [[package]] name = "tengri_input" -version = "0.3.4" +version = "0.4.0" dependencies = [ "tengri_dsl", "tengri_tui", @@ -963,7 +963,7 @@ dependencies = [ [[package]] name = "tengri_output" -version = "0.3.4" +version = "0.4.0" dependencies = [ "proptest", "proptest-derive", @@ -974,7 +974,7 @@ dependencies = [ [[package]] name = "tengri_tui" -version = "0.3.4" +version = "0.4.0" dependencies = [ "atomic_float", "better-panic", diff --git a/Cargo.toml b/Cargo.toml index e0a2345..bcd0bd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.4" +version = "0.4.0" [workspace] resolver = "2" diff --git a/tui/src/tui_engine/tui_output.rs b/tui/src/tui_engine/tui_output.rs index 900ca0b..3a46b60 100644 --- a/tui/src/tui_engine/tui_output.rs +++ b/tui/src/tui_engine/tui_output.rs @@ -55,37 +55,10 @@ impl TuiOut { std::thread::sleep(timer); }) } - pub fn buffer_update (&mut self, area: [u16;4], callback: &impl Fn(&mut Cell, u16, u16)) { - buffer_update(&mut self.buffer, area, callback); - } - pub fn fill_bold (&mut self, area: [u16;4], on: bool) { - if on { - self.buffer_update(area, &|cell,_,_|cell.modifier.insert(Modifier::BOLD)) - } else { - self.buffer_update(area, &|cell,_,_|cell.modifier.remove(Modifier::BOLD)) - } - } - pub fn fill_bg (&mut self, area: [u16;4], color: Color) { - self.buffer_update(area, &|cell,_,_|{cell.set_bg(color);}) - } - pub fn fill_fg (&mut self, area: [u16;4], color: Color) { - self.buffer_update(area, &|cell,_,_|{cell.set_fg(color);}) - } - pub fn fill_ul (&mut self, area: [u16;4], color: Color) { - self.buffer_update(area, &|cell,_,_|{ - cell.modifier = ratatui::prelude::Modifier::UNDERLINED; - cell.underline_color = color; - }) - } - pub fn fill_char (&mut self, area: [u16;4], c: char) { - self.buffer_update(area, &|cell,_,_|{cell.set_char(c);}) - } - pub fn make_dim (&mut self) { - for cell in self.buffer.content.iter_mut() { - cell.bg = ratatui::style::Color::Rgb(30,30,30); - cell.fg = ratatui::style::Color::Rgb(100,100,100); - cell.modifier = ratatui::style::Modifier::DIM; - } + #[inline] + pub fn with_rect (&mut self, area: [u16;4]) -> &mut Self { + self.area = area; + self } pub fn blit ( &mut self, text: &impl AsRef, x: u16, y: u16, style: Option