Module pix_engine::shape::rect
source · Expand description
A shape type representing squares and rectangles used for drawing.
Examples
You can create a Rect or square using Rect::new
or Rect::square
:
use pix_engine::prelude::*;
let r = Rect::new(10, 20, 100, 200);
let s = Rect::square(10, 20, 100);
…or by using the rect! or square! macros:
use pix_engine::prelude::*;
let r = rect!(10, 20, 100, 200);
let s = square!(10, 20, 100);
// using a point
let r = rect!([10, 20], 100, 200);
let r = rect!(point![10, 20], 100, 200);
let s = square!([10, 20], 100);
let s = square!(point![10, 20], 100);
Structs
- A
Rectangle
positioned at(x, y)
withwidth
andheight
. A square is aRectangle
wherewidth
andheight
are equal.