From e16fbc784a5db7b16f769122fb89fb8ced1a9bb7 Mon Sep 17 00:00:00 2001 From: Tony Aldridge Date: Sat, 21 Sep 2013 12:39:11 +0100 Subject: [PATCH] Rects and Points can now be cloned --- src/rect.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rect.rs b/src/rect.rs index d1180e85..f0fc41dc 100644 --- a/src/rect.rs +++ b/src/rect.rs @@ -4,12 +4,14 @@ use std::ptr; use std::vec; #[deriving(Eq)] +#[deriving(Clone)] pub struct Point{ x: i32, y: i32 } #[deriving(Eq)] +#[deriving(Clone)] pub struct Rect { x: i32, y: i32, @@ -115,8 +117,8 @@ impl Rect { } pub fn intersect_line(&self, start: &Point, end: &Point) -> Option<(Point, Point)> { - let out_start: Point = *start.clone(); - let out_end: Point = *end.clone(); + let out_start: Point = start.clone(); + let out_end: Point = end.clone(); let result = unsafe { ll::SDL_IntersectRectAndLine(self, &out_start.x, &out_start.y, &out_end.x, &out_end.y) == 0