mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-08-07 22:17:07 +02:00
more entrypoint macros
This commit is contained in:
parent
4cfe8d087c
commit
66ac2bcbb6
18 changed files with 696 additions and 663 deletions
19
src/draw.rs
19
src/draw.rs
|
|
@ -7,13 +7,22 @@ use crate::*;
|
|||
/// struct TestOut { w: u16, h: u16 };
|
||||
/// impl Wide<u16> for TestOut {}
|
||||
/// impl Tall<u16> for TestOut {}
|
||||
/// impl Xy<u16> for TestOut { fn x (&self) -> u16 { 0 } fn y (&self) -> u16 { 0 } }
|
||||
/// impl Xy<u16> for TestOut {
|
||||
/// fn x (&self) -> u16 { 0 }
|
||||
/// fn y (&self) -> u16 { 0 }
|
||||
/// }
|
||||
/// impl Screen for TestOut {
|
||||
/// type Unit = u16;
|
||||
/// fn show <D: Draw<Self>> (&mut self, _: D) -> Drawn<u16> {
|
||||
/// println!("placed");
|
||||
/// Ok(None)
|
||||
/// }
|
||||
/// fn show (&mut self, _: impl Draw<Self>) -> Perhaps<XYWH<u16>>
|
||||
/// { println!("placed"); Ok(None) }
|
||||
/// fn area (&self) -> XYWH<Self::Unit>
|
||||
/// { Default::default() }
|
||||
/// fn clip <T> (
|
||||
/// &mut self,
|
||||
/// area: impl Into<Option<XYWH<u16>>>,
|
||||
/// draw: impl FnOnce(&mut Self)->T
|
||||
/// ) -> T
|
||||
/// { draw(self) }
|
||||
/// }
|
||||
///
|
||||
/// impl_draw!(|self: String, to: TestOut|{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue