Struct ggez::graphics::Rect[][src]

pub struct Rect {
    pub x: f32,
    pub y: f32,
    pub w: f32,
    pub h: f32,

A simple 2D rectangle.

The origin of the rectangle is at the top-left, with x increasing to the right and y increasing down.


X coordinate of the left edge of the rect.

Y coordinate of the top edge of the rect.

Total width of the rect

Total height of the rect.


impl Rect

Create a new rect.

Creates a new rect a la Love2D's, as a fraction of the reference rect's size.

Create a new rect from i32 coordinates.

Create a new Rect with all values zero.

Creates a new Rect at 0,0 with width and height 1.

Gets the Rect's x and y coordinates as a Point2.

Returns the left edge of the Rect

Returns the right edge of the Rect

Returns the top edge of the Rect

Returns the bottom edge of the Rect

Checks whether the Rect contains a Point

Checks whether the Rect overlaps another Rect

Translates the Rect by an offset of (x, y)

Moves the Rect's origin to (x, y)

Scales the Rect by a factor of (sx, sy), growing towards the bottom-left

Trait Implementations

impl Copy for Rect

impl Clone for Rect

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Rect

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for Rect

Formats the value using the given formatter. Read more

impl Default for Rect

Returns the "default value" for a type. Read more

impl From<[f32; 4]> for Rect

Performs the conversion.

impl From<Rect> for [f32; 4]

Performs the conversion.

Auto Trait Implementations

impl Send for Rect

impl Sync for Rect