use the new macro in examples

This commit is contained in:
griffi-gh 2024-03-24 18:32:50 +01:00
parent 47c5f1c4a8
commit 39746aa566
2 changed files with 20 additions and 17 deletions

View file

@ -1,5 +1,8 @@
use hui::{ use hui::{
color, element::{container::Container, text::Text, UiElementExt}, frame::FrameRect, layout::Alignment, size color, size, frame_rect,
element::{container::Container, text::Text, UiElementExt},
frame::FrameRect,
layout::Alignment,
}; };
#[path = "../boilerplate.rs"] #[path = "../boilerplate.rs"]
@ -12,10 +15,10 @@ ui_main!(|ui, size, _| {
.with_align(Alignment::Center) .with_align(Alignment::Center)
.with_padding(5.) .with_padding(5.)
.with_gap(10.) .with_gap(10.)
.with_background( .with_background(frame_rect! {
FrameRect::color(color::WHITE) color: (0.5, 0.5, 0.5, 1.),
.with_corner_radius(10.) corner_radius: 10.,
) })
.with_children(|ui| { .with_children(|ui| {
Text::default() Text::default()
.with_text("Hello, world") .with_text("Hello, world")
@ -24,10 +27,10 @@ ui_main!(|ui, size, _| {
.add_child(ui); .add_child(ui);
Container::default() Container::default()
.with_padding((10., 20.)) .with_padding((10., 20.))
.with_background( .with_background(frame_rect! {
FrameRect::color(color::DARK_RED) color: color::DARK_RED,
.with_corner_radius((2.5, 30., 2.5, 2.5)) corner_radius: (2.5, 30., 2.5, 2.5),
) })
.with_children(|ui| { .with_children(|ui| {
Text::default() Text::default()
.with_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.") .with_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")

View file

@ -45,10 +45,10 @@ ui_main!(
.with_children(|ui| { .with_children(|ui| {
Container::default() Container::default()
.with_padding((10., 15.)) .with_padding((10., 15.))
.with_background( .with_background(frame_rect! {
FrameRect::color((0., 0., 0., 0.5)) color: (0., 0., 0., 0.5),
.with_corner_radius(8.) corner_radius: 8.,
) })
.with_children(|ui| { .with_children(|ui| {
let flash = 1. - 0.5 * (4. * instant.elapsed().as_secs_f32()).sin().powi(2); let flash = 1. - 0.5 * (4. * instant.elapsed().as_secs_f32()).sin().powi(2);
Text::default() Text::default()
@ -111,10 +111,10 @@ ui_main!(
.with_children(|ui| { .with_children(|ui| {
Container::default() Container::default()
.with_padding(10.) .with_padding(10.)
.with_background( .with_background(frame_rect!{
FrameRect::color((0., 0., 0., 0.5)) color: (0., 0., 0., 0.5),
.with_corner_radius(8.) corner_radius: 8.,
) })
.with_children(|ui| { .with_children(|ui| {
Text::default() Text::default()
.with_text("Level 5") .with_text("Level 5")