basic_rectangle/
basic_rectangle.rs1use clay_layout::{
2 elements::{rectangle::Rectangle, CornerRadius},
3 fixed,
4 id::Id,
5 layout::Layout,
6 Clay,
7};
8
9fn main() {
10 let clay = Clay::new((800., 600.).into());
12
13 clay.begin();
15
16 clay.with(
19 [
20 Id::new("red_rectangle"),
21 Layout::new().width(fixed!(50.)).height(fixed!(50.)).end(),
22 Rectangle::new()
23 .color((0xFF, 0x00, 0x00).into())
24 .corner_radius(CornerRadius::All(5.))
25 .end(),
26 ],
27 |_| {},
28 );
29
30 let render_commands = clay.end();
32
33 for command in render_commands {
34 println!("Id of the element: {}", command.id); println!("Bounding box: {:?}", command.bounding_box);
36 println!("Type and config: {:?}", command.config);
37 }
38}