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 ggez convention is that x
and y
are the center of the rectangle,
with width
and height
being the total width and height, because this
is generally also how OpenGL tends to think about the world.
Fields
x: f32
y: f32
w: f32
h: f32
Methods
impl Rect
[src]
fn new(x: f32, y: f32, w: f32, h: f32) -> Self
fn fraction(x: f32, y: f32, w: f32, h: f32, reference: &Rect) -> Rect
Ceates a new rect a la Love2D's love.graphics.newQuad, as a fraction of the reference rect's size.
fn new_i32(x: i32, y: i32, w: i32, h: i32) -> Self
fn zero() -> Self
Create a new Rect
with all values zero.
fn one() -> Self
Creates a new Rect
at 0,0 with width and height 1.
fn point(&self) -> Point
Gets the Rect
's x and y coordinates as a Point
.
fn left(&self) -> f32
Returns the left edge of the Rect
fn right(&self) -> f32
Returns the right edge of the Rect
fn top(&self) -> f32
Returns the top edge of the Rect
fn bottom(&self) -> f32
Returns the bottom edge of the Rect
Trait Implementations
impl Copy for Rect
[src]
impl Clone for Rect
[src]
fn clone(&self) -> Rect
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 PartialEq for Rect
[src]
fn eq(&self, __arg_0: &Rect) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rect) -> bool
This method tests for !=
.