reactivity base

This commit is contained in:
2025-08-10 02:05:35 -04:00
parent 56beeb80f3
commit 58d9b32077
12 changed files with 394 additions and 328 deletions

View File

@@ -1,7 +1,7 @@
use std::sync::Arc;
use app::App;
use gui::{primitive::Axis, NodeArrayUtil, NodeUtil, RoundedRect, UIColor};
use gui::{primitive::Axis, RoundedRect, UIColor, WidgetArrLike, WidgetArrUtil, WidgetUtil, UI};
use render::Renderer;
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
@@ -25,24 +25,32 @@ impl Client {
thickness: 0.0,
inner_radius: 0.0,
};
let ui = (
let mut ui = UI::build();
let blue = ui.add(rect.color(UIColor::BLUE));
let handle = blue.handle();
let mut ui = ui.finish(
(
rect.color(UIColor::BLUE),
(
rect.color(UIColor::RED),
(rect.color(UIColor::ORANGE), rect.color(UIColor::LIME))
.proportioned(Axis::Y, [1, 1]),
rect.color(UIColor::YELLOW),
blue,
(
rect.color(UIColor::RED),
(
rect.color(UIColor::ORANGE),
rect.color(UIColor::LIME).pad(10.0),
)
.span(Axis::Y, [1, 1]),
rect.color(UIColor::YELLOW),
)
.span(Axis::X, [2, 2, 1])
.pad(10),
)
.proportioned(Axis::X, [2, 2, 1])
.pad(10),
.span(Axis::X, [1, 3]),
rect.color(UIColor::GREEN),
)
.proportioned(Axis::X, [1, 3]),
rect.color(UIColor::GREEN),
)
.proportioned(Axis::Y, [3, 1])
.pad(10)
.into();
.span(Axis::Y, [3, 1])
.pad(10),
);
ui.widgets.get_mut(&handle).unwrap().color = UIColor::MAGENTA;
renderer.update(&ui);
Self { renderer }
}