1
0
Fork 0
forked from wry/wry

autocommit 2022-02-05 02:07:07 CET

This commit is contained in:
Julian Orth 2022-02-05 02:07:07 +01:00
parent 89bfd2ffcd
commit 2d8b3a200e
21 changed files with 328 additions and 87 deletions

View file

@ -1,17 +1,5 @@
use std::fmt::{Debug, Formatter};
#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct Point {
pub x: i32,
pub y: i32,
}
impl Point {
pub fn translate(&self, x: i32, y: i32) -> (i32, i32) {
(x - self.x, y - self.y)
}
}
#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct Rect {
x1: i32,
@ -65,13 +53,6 @@ impl Rect {
}
}
pub fn to_point(&self) -> Point {
Point {
x: self.x1,
y: self.y1,
}
}
pub fn new(x1: i32, y1: i32, x2: i32, y2: i32) -> Option<Self> {
if x2 < x1 || y2 < y1 {
return None;