Macro pix_engine::shape::rect
source · macro_rules! rect { ($p1:expr, $p2:expr$(,)?) => { ... }; ($p:expr, $width:expr, $height:expr$(,)?) => { ... }; ($x:expr, $y:expr, $width:expr, $height:expr$(,)?) => { ... }; }
Expand description
Constructs a Rect at position (x, y)
with width
and height
.
let p = point!(10, 20);
let r = rect!(p, 100, 200);
assert_eq!(r.x(), 10);
assert_eq!(r.y(), 20);
assert_eq!(r.width(), 100);
assert_eq!(r.height(), 200);
let r = rect!(10, 20, 100, 200);
assert_eq!(r.x(), 10);
assert_eq!(r.y(), 20);
assert_eq!(r.width(), 100);
assert_eq!(r.height(), 200);