spans now good (other than direction) + refactor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use app::App;
|
||||
use gui::{Dir, Rect, UI, UIColor, WidgetArrUtil, fixed, ratio, rel};
|
||||
use gui::{Dir, Rect, UI, UIColor, WidgetArrUtil, WidgetUtil, fixed, ratio, rel};
|
||||
use render::Renderer;
|
||||
use winit::{event::WindowEvent, event_loop::ActiveEventLoop, window::Window};
|
||||
|
||||
@@ -21,36 +21,30 @@ impl Client {
|
||||
let mut renderer = Renderer::new(window);
|
||||
let rect = Rect {
|
||||
color: UIColor::WHITE,
|
||||
radius: 50.0,
|
||||
radius: 20.0,
|
||||
thickness: 0.0,
|
||||
inner_radius: 0.0,
|
||||
};
|
||||
let mut ui = UI::build();
|
||||
let blue = ui.add(rect.color(UIColor::BLUE));
|
||||
let handle = blue.handle();
|
||||
// let mut ui = ui.finish(
|
||||
// (
|
||||
// (
|
||||
// blue,
|
||||
// (
|
||||
// rect.color(UIColor::RED).center((100.0, 100.0)),
|
||||
// (
|
||||
// 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),
|
||||
// )
|
||||
// .span(Axis::X, [1, 3]),
|
||||
// rect.color(UIColor::GREEN),
|
||||
// )
|
||||
// .span(Axis::Y, [3, 1])
|
||||
// .pad(10),
|
||||
// );
|
||||
let mut ui = ui.finish(
|
||||
(
|
||||
(
|
||||
blue,
|
||||
(
|
||||
rect.color(UIColor::RED).center((100.0, 100.0)),
|
||||
(
|
||||
rect.color(UIColor::ORANGE),
|
||||
rect.color(UIColor::LIME).pad(10.0),
|
||||
)
|
||||
.span(Dir::RIGHT, [1, 1]),
|
||||
rect.color(UIColor::YELLOW),
|
||||
)
|
||||
.span(Dir::RIGHT, [2, 2, 1])
|
||||
.pad(10),
|
||||
)
|
||||
.span(Dir::RIGHT, [1, 3]),
|
||||
(
|
||||
rect.color(UIColor::GREEN),
|
||||
rect.color(UIColor::ORANGE),
|
||||
@@ -70,6 +64,9 @@ impl Client {
|
||||
fixed(100),
|
||||
],
|
||||
),
|
||||
)
|
||||
.span(Dir::DOWN, [3, 1])
|
||||
.pad(10),
|
||||
);
|
||||
ui.widgets.get_mut(&handle).unwrap().color = UIColor::MAGENTA;
|
||||
renderer.update(&ui);
|
||||
|
||||
Reference in New Issue
Block a user