mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-13 23:26:41 +01:00
add more proptests for output
This commit is contained in:
parent
c78dd2453a
commit
2e18ca96fd
9 changed files with 154 additions and 78 deletions
|
|
@ -1,20 +1,5 @@
|
|||
use crate::*;
|
||||
pub use self::Direction::*;
|
||||
/// A cardinal direction.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum Direction { North, South, East, West, Above, Below }
|
||||
impl Direction {
|
||||
pub fn split_fixed <N: Coordinate> (self, area: impl Area<N>, a: N) -> ([N;4],[N;4]) {
|
||||
let [x, y, w, h] = area.xywh();
|
||||
match self {
|
||||
North => ([x, (y+h).minus(a), w, a], [x, y, w, h.minus(a)]),
|
||||
South => ([x, y, w, a], [x, y + a, w, h.minus(a)]),
|
||||
East => ([x, y, a, h], [x + a, y, w.minus(a), h]),
|
||||
West => ([(x+w).minus(a), y, a, h], [x, y, w - a, h]),
|
||||
Above | Below => (area.xywh(), area.xywh())
|
||||
}
|
||||
}
|
||||
}
|
||||
pub use Direction::*;
|
||||
/// A split or layer.
|
||||
pub struct Bsp<X, Y>(Direction, X, Y);
|
||||
impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue