wip: "multiple cascading refactors"

https://loglog.games/blog/leaving-rust-gamedev/#orphan-rule-should-be-optional is on point
This commit is contained in:
🪞👃🪞 2024-09-09 21:25:04 +03:00
parent 20afc397ea
commit fa8282a9d5
18 changed files with 175 additions and 222 deletions

View file

@ -30,12 +30,13 @@ impl<E: Engine> Process for Mixer<E> {
Control::Continue
}
}
impl Render<Tui> for Mixer<Tui> {
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
impl Content for Mixer<Tui> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
let mut tracks = Split::right();
for channel in self.tracks.iter() {
tracks = tracks.add_ref(channel)
}
tracks.render(to)
tracks
}
}

View file

@ -1,13 +1,9 @@
use crate::*;
use tek_core::Direction;
impl Layout<Tui> for Track<Tui> {
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
todo!()
}
}
impl Render<Tui> for Track<Tui> {
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
impl Content for Track<Tui> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
TrackView {
chain: Some(&self),
direction: tek_core::Direction::Right,
@ -26,7 +22,7 @@ impl Render<Tui> for Track<Tui> {
//pub output_ports: Vec<Port<AudioOut>>,
//pub post_fader_meter: f64,
//pub route: String,
}.render(to)
}
}
}
pub struct TrackView<'a, E: Engine> {
@ -35,7 +31,11 @@ pub struct TrackView<'a, E: Engine> {
pub focused: bool,
pub entered: bool,
}
impl<'a> Render<Tui> for TrackView<'a, Tui> {
impl<'a> Widget for TrackView<'a, Tui> {
type Engine = Tui;
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
todo!()
}
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
todo!();
//let mut area = to.area();