wip: replacing Rect with [u16;4] in mixer and sequencer

This commit is contained in:
🪞👃🪞 2024-09-07 12:50:52 +03:00
parent fa739a49b2
commit 06f8bd1116
14 changed files with 106 additions and 106 deletions

View file

@ -1,13 +1,13 @@
use crate::*;
impl Render<Tui> for Sampler {
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
tui_render_sampler(self, to)
}
}
pub fn tui_render_sampler (sampler: &Sampler, to: &mut Tui) -> Perhaps<Rect> {
let Rect { x, y, height, .. } = to.area();
pub fn tui_render_sampler (sampler: &Sampler, to: &mut Tui) -> Perhaps<[u16;4]> {
let [x, y, _, height] = to.area();
let style = Style::default().gray();
let title = format!(" {} ({})", sampler.name, sampler.voices.read().unwrap().len());
to.blit(&title, x+1, y, Some(style.white().bold().not_dim()))?;
@ -29,7 +29,7 @@ pub fn tui_render_sampler (sampler: &Sampler, to: &mut Tui) -> Perhaps<Rect> {
j = j + 1;
}
let height = ((2 + y1) as u16).min(height);
Ok(Some(Rect { x, y, width: (width as u16).min(to.area().width), height }))
Ok(Some([x, y, (width as u16).min(to.area().w()), height]))
}
fn draw_sample (