[−][src]Struct megaui::Rect
A simple 2D rectangle.
The origin of the rectangle is at the top-left, with x increasing to the right and y increasing down.
Fields
x: f32
X coordinate of the left edge of the rect.
y: f32
Y coordinate of the top edge of the rect.
w: f32
Total width of the rect
h: f32
Total height of the rect.
Implementations
impl Rect
[src]
pub fn new(x: f32, y: f32, w: f32, h: f32) -> Self
[src]
Create a new Rect
.
pub fn fraction(x: f32, y: f32, w: f32, h: f32, reference: &Rect) -> Rect
[src]
Creates a new Rect
a la Love2D's love.graphics.newQuad
,
as a fraction of the reference rect's size.
pub fn new_i32(x: i32, y: i32, w: i32, h: i32) -> Self
[src]
Create a new rect from i32
coordinates.
pub fn zero() -> Self
[src]
Create a new Rect
with all values zero.
pub fn one() -> Self
[src]
Creates a new Rect
at 0,0
with width and height 1.
pub fn left(&self) -> f32
[src]
Returns the left edge of the Rect
pub fn right(&self) -> f32
[src]
Returns the right edge of the Rect
pub fn top(&self) -> f32
[src]
Returns the top edge of the Rect
pub fn bottom(&self) -> f32
[src]
Returns the bottom edge of the Rect
pub fn contains(&self, point: Vector2) -> bool
[src]
Checks whether the Rect
contains a Point
pub fn overlaps(&self, other: &Rect) -> bool
[src]
Checks whether the Rect
overlaps another Rect
pub fn combine_with(self, other: Rect) -> Rect
[src]
Returns a new Rect
that includes all points of these two Rect
s.
pub fn intersect(&self, other: Rect) -> Option<Rect>
[src]
pub fn offset(self, offset: Vector2) -> Rect
[src]
Trait Implementations
impl Clone for Rect
[src]
impl Copy for Rect
[src]
impl Debug for Rect
[src]
impl Default for Rect
[src]
impl PartialEq<Rect> for Rect
[src]
impl StructuralPartialEq for Rect
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rect
[src]
impl Send for Rect
[src]
impl Sync for Rect
[src]
impl Unpin for Rect
[src]
impl UnwindSafe for Rect
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,