Rects and Points can now be cloned

This commit is contained in:
Tony Aldridge
2013-09-21 12:39:11 +01:00
parent 7c4af5e549
commit e16fbc784a
+4 -2
View File
@@ -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