mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-08-07 22:17:07 +02:00
big flat
This commit is contained in:
parent
94c26f06cc
commit
fc01fd6ad3
40 changed files with 2075 additions and 1807 deletions
21
src/layout/area.rs
Normal file
21
src/layout/area.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use crate::{*, draw::*};
|
||||
|
||||
/// ```
|
||||
/// use tengri::*;
|
||||
/// let _ = area(None, "unareaed");
|
||||
/// let _ = area(XYWH(1, 2, 3, 4), "southeast");
|
||||
/// let _ = area(Some(XYWH(1, 2, 3, 4)), "southeast");
|
||||
/// ```
|
||||
pub fn area <S: Screen, T: Draw<S>, U: Into<Option<XYWH<S::Unit>>>> (
|
||||
origin: U, it: T
|
||||
) -> Area<S, T> {
|
||||
Area(origin.into(), it)
|
||||
}
|
||||
|
||||
pub struct Area<S: Screen, T: Draw<S>>(
|
||||
pub Option<XYWH<S::Unit>>,
|
||||
pub T
|
||||
);
|
||||
impl_draw!(<S: Screen, T: Draw<S>,>|self: Area<S, T>, to: S|{
|
||||
to.clip(self.0, |to|self.1.draw(to))
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue