rect2d: getters for size, top_left, height and width
This commit is contained in:
parent
66ae2603e6
commit
208b1569d6
|
@ -301,6 +301,23 @@ impl Rect2D {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn top_left(&self) -> glam::IVec2 {
|
||||||
|
self.top_left
|
||||||
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn size(&self) -> glam::IVec2 {
|
||||||
|
self.bottom_right - self.top_left
|
||||||
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn width(&self) -> i32 {
|
||||||
|
self.bottom_right.x - self.top_left.x
|
||||||
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn height(&self) -> i32 {
|
||||||
|
self.bottom_right.y - self.top_left.y
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn eq_f32(lhs: f32, rhs: f32) -> bool {
|
pub fn eq_f32(lhs: f32, rhs: f32) -> bool {
|
||||||
|
|
Loading…
Reference in a new issue