Skip to main content

Rectangles

rect!

Draws rectangles.

turbo::canvas
rect!(
w: u32,
h: u32,
x: i32,
y: i32,
color: u32,
rotate: i32,
scale_x: f32,
scale_y: f32,
border_width: u32,
border_color: u32,
border_radius: u32,
)
ParamTypeDefaultDescription
wu320Width of the rectangle in pixels
hu320Height of the rectangle in pixels
xi320X position of the left side of the rectangle in pixels
yi320Y position of the top side of the rectangle in pixels
coloru320xffffffffColor that fills the rectangle as RGBA hex
rotatei320Degrees of rotation. Positive clockwise. Negative counter-clockwise
scale_xf321.0Horizontal scaling - 1.0 is 100% (aka, no scaling)
scale_yf321.0Vertical scaling - 1.0 is 100% (aka, no scaling)
border_widthu320Border width in pixels
border_coloru320x000000Border color as RGBA hex
border_radiusu320Border radius in pixels

Basic Usage

rect!(w = 20, h = 40, x = 70, y = 70, color = 0x0000ffff);

Rect Screenshot

Advanced Usage

rect!(
x = 112,
y = 56,
w = 32,
h = 32,
color = 0x0000ffff,
rotate = 45,
border_width = 2,
border_color = 0xffffffff,
border_radius = 4,
);

Rectv Screenshot