[−][src]Struct sfml::graphics::Rect
Utility type for manipulating 2D axis-aligned rectangles.
Fields
left: TLeft coordinate of the rectangle.
top: TTop coordinate of the rectangle.
width: TWidth of the rectangle.
height: THeight of the rectangle.
Methods
impl<T> Rect<T>[src]
pub fn new(left: T, top: T, width: T, height: T) -> Self[src]
Construct a rectangle from its coordinates.
pub fn from_vecs(pos: Vector2<T>, size: Vector2<T>) -> Rect<T>[src]
Construct a rectangle from its position and size.
impl<T: PartialOrd + Add<Output = T> + Sub<Output = T> + Copy> Rect<T>[src]
pub fn contains(self, point: Vector2<T>) -> bool[src]
Check if a point is inside the rectangle's area.
pub fn contains2(self, x: T, y: T) -> bool[src]
Check if a point is inside the rectangle's area.
pub fn intersection(self, other: &Rect<T>) -> Option<Rect<T>>[src]
Returns the intersection between two rectangles, if any.
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]
impl<T: Copy> Copy for Rect<T>[src]
impl<T: Default> Default for Rect<T>[src]
impl<T: Eq> Eq for Rect<T>[src]
impl<T: Ord> Ord for Rect<T>[src]
fn cmp(&self, other: &Rect<T>) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> Self1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self[src]
impl<T: PartialEq> PartialEq<Rect<T>> for Rect<T>[src]
impl<T: PartialOrd> PartialOrd<Rect<T>> for Rect<T>[src]
fn partial_cmp(&self, other: &Rect<T>) -> Option<Ordering>[src]
fn lt(&self, other: &Rect<T>) -> bool[src]
fn le(&self, other: &Rect<T>) -> bool[src]
fn gt(&self, other: &Rect<T>) -> bool[src]
fn ge(&self, other: &Rect<T>) -> bool[src]
impl<T: Debug> Debug for Rect<T>[src]
Auto Trait Implementations
impl<T> Send for Rect<T> where
T: Send,
T: Send,
impl<T> Sync for Rect<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Rect<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Rect<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Rect<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,