Struct sfml_types::Rect
[−]
[src]
#[repr(C)]pub struct Rect<T> { pub left: T, pub top: T, pub width: T, pub height: T, }
Utility type for manipulating 2D axis-aligned rectangles.
Fields
left: T
Left coordinate of the rectangle.
top: T
Top coordinate of the rectangle.
width: T
Width of the rectangle.
height: T
Height of the rectangle.
Methods
impl<T> Rect<T>
[src]
fn new(left: T, top: T, width: T, height: T) -> Rect<T>
Construct a rectangle from its coordinates.
fn from_vecs(pos: Vector2<T>, size: Vector2<T>) -> Rect<T>
Construct a rectangle from its position and size.
impl<T: PartialOrd + Add<Output = T> + Sub<Output = T> + Copy> Rect<T>
[src]
fn contains(self, point: Vector2<T>) -> bool
Check if a point is inside the rectangle's area.
fn contains2(self, x: T, y: T) -> bool
Check if a point is inside the rectangle's area.
fn intersects(self, other: &Rect<T>) -> Option<Rect<T>>
Check the intersection between two rectangles.
If the rectangles intersect, returns Some filled with the intersection of the two rectangles. Otherwise, returns None.
Trait Implementations
impl<T: Clone> Clone for Rect<T>
[src]
fn clone(&self) -> Rect<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for Rect<T>
[src]
fn eq(&self, __arg_0: &Rect<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rect<T>) -> bool
This method tests for !=
.
impl<T: Eq> Eq for Rect<T>
[src]
impl<T: PartialOrd> PartialOrd for Rect<T>
[src]
fn partial_cmp(&self, __arg_0: &Rect<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Rect<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Rect<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Rect<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Rect<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Ord> Ord for Rect<T>
[src]
fn cmp(&self, __arg_0: &Rect<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more