diff --git a/src/testing/mod.rs b/src/testing/mod.rs index abf1dca..e0f6d2b 100644 --- a/src/testing/mod.rs +++ b/src/testing/mod.rs @@ -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,55 +21,52 @@ 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( ( - rect.color(UIColor::GREEN), - rect.color(UIColor::ORANGE), - rect.color(UIColor::CYAN), - rect.color(UIColor::BLUE), - rect.color(UIColor::MAGENTA), - rect.color(UIColor::RED), + ( + 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), + rect.color(UIColor::CYAN), + rect.color(UIColor::BLUE), + rect.color(UIColor::MAGENTA), + rect.color(UIColor::RED), + ) + .span( + Dir::RIGHT, + [ + fixed(100), + ratio(1), + ratio(1), + rel(0.5), + fixed(100), + fixed(100), + ], + ), ) - .span( - Dir::RIGHT, - [ - fixed(100), - ratio(1), - ratio(1), - rel(0.5), - fixed(100), - fixed(100), - ], - ), + .span(Dir::DOWN, [3, 1]) + .pad(10), ); ui.widgets.get_mut(&handle).unwrap().color = UIColor::MAGENTA; renderer.update(&ui);