From be44dbed3dbac1dbe0ba5eed4c69fcecc9a32dca Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Sat, 30 Oct 2021 10:12:45 +0100 Subject: [PATCH] add useful derives --- agb/src/number.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agb/src/number.rs b/agb/src/number.rs index 0032d43e..8020f576 100644 --- a/agb/src/number.rs +++ b/agb/src/number.rs @@ -639,6 +639,7 @@ impl From> for Vector2 } } +#[derive(PartialEq, Eq, Clone)] pub struct Rect { pub position: Vector2D, pub size: Vector2D, @@ -656,7 +657,7 @@ impl Rect { && point.y < self.position.y + self.size.y } - pub fn touches(self, other: Rect) -> bool { + pub fn touches(&self, other: Rect) -> bool { self.position.x < other.position.x + other.size.x && self.position.x + self.size.x > other.position.x && self.position.y < other.position.y + other.size.y