mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 19:56:44 +01:00
output: refactor Content and Render traits
This commit is contained in:
parent
74b3af2212
commit
1c21a85f27
24 changed files with 346 additions and 613 deletions
|
|
@ -15,7 +15,7 @@ impl<A, B> Bsp<A, B> {
|
|||
#[inline] pub const fn a (a: A, b: B) -> Self { Self(Above, a, b) }
|
||||
#[inline] pub const fn b (a: A, b: B) -> Self { Self(Below, a, b) }
|
||||
}
|
||||
impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
|
||||
impl<E: Output, A: Render<E>, B: Render<E>> Render<E> for Bsp<A, B> {
|
||||
fn layout (&self, outer: E::Area) -> E::Area { let [_, _, c] = self.areas(outer); c }
|
||||
fn render (&self, to: &mut E) {
|
||||
let [area_a, area_b, _] = self.areas(to.area());
|
||||
|
|
@ -26,11 +26,11 @@ impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl<E: Output, A: Content<E>, B: Content<E>> BspAreas<E, A, B> for Bsp<A, B> {
|
||||
impl<E: Output, A: Render<E>, B: Render<E>> BspAreas<E, A, B> for Bsp<A, B> {
|
||||
fn direction (&self) -> Direction { self.0 }
|
||||
fn contents (&self) -> (&A, &B) { (&self.1, &self.2) }
|
||||
}
|
||||
pub trait BspAreas<E: Output, A: Content<E>, B: Content<E>> {
|
||||
pub trait BspAreas<E: Output, A: Render<E>, B: Render<E>> {
|
||||
fn direction (&self) -> Direction;
|
||||
fn contents (&self) -> (&A, &B);
|
||||
fn areas (&self, outer: E::Area) -> [E::Area;3] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue