ui thrashing

This commit is contained in:
🪞👃🪞 2024-07-07 17:55:05 +03:00
parent acb952736e
commit 20b7267225
18 changed files with 695 additions and 233 deletions

View file

@ -3,6 +3,21 @@ pub(crate) use ratatui::prelude::*;
pub(crate) use ratatui::buffer::Cell;
use ratatui::widgets::WidgetRef;
pub fn fill_bg (buf: &mut Buffer, area: Rect, color: Color) {
let Rect { x, y, width, height } = area;
for y in y..y+height {
if y >= buf.area.height {
break
}
for x in x..x+width {
if x >= buf.area.width {
break
}
buf.get_mut(x, y).set_bg(color);
}
}
}
pub trait Blit {
// Render something to X, Y coordinates in a buffer, ignoring width/height.
fn blit (&self, buf: &mut Buffer, x: u16, y: u16, style: Option<Style>);