mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-07-17 15:56:57 +02:00
fix Size, begin fixing View
This commit is contained in:
parent
a06ea2ac13
commit
a93fe92a59
3 changed files with 38 additions and 18 deletions
21
src/space.rs
21
src/space.rs
|
|
@ -491,3 +491,24 @@ pub fn iter_west <
|
|||
> (_items: V, _cb: F) -> impl Draw<T> {
|
||||
thunk(move|_to: &mut T|{ todo!() })
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct Size(AtomicUsize, AtomicUsize);
|
||||
impl X<u16> for Size {
|
||||
fn x (&self) -> u16 { 0 }
|
||||
fn w (&self) -> u16 { self.0.load(Relaxed) as u16 }
|
||||
}
|
||||
impl Y<u16> for Size {
|
||||
fn y (&self) -> u16 { 0 }
|
||||
fn h (&self) -> u16 { self.1.load(Relaxed) as u16 }
|
||||
}
|
||||
impl Size {
|
||||
pub const fn of <T: Screen> (&self, of: impl Draw<T>) -> impl Draw<T> {
|
||||
thunk(move|to: &mut T|{
|
||||
let area = of.draw(to)?;
|
||||
self.0.store(area.w().into(), Relaxed);
|
||||
self.1.store(area.h().into(), Relaxed);
|
||||
Ok(area)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue