mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
ui thrashing
This commit is contained in:
parent
acb952736e
commit
20b7267225
18 changed files with 695 additions and 233 deletions
|
|
@ -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>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue