use cotis::cotis_app::UiFn;
use cotis::element_configuring::ConfigureElements;
use cotis::pipes::LayoutRenderPipe;
use cotis::renders::CotisRenderer;
use cotis_layout::layout_struct::RenderCommandOutput;
use cotis_modules_debug::layout_module_debugger::load_computed_layout;
use cotis_pipes::cotis_layout_pipes::CotisLayoutToRenderListPipeForGenerics;
use cotis_raylib::prelude::RaylibRender;
use raylib::consts::TextureFilter;
#[path = "common/support.rs"]
mod support;
use support::{ExampleConfig, SimpleRenderCmds, example_path};
fn main() {
let replay: Vec<RenderCommandOutput<ExampleConfig>> = load_computed_layout(
example_path("examples/elements_gradients_solid_example.json").as_path(),
)
.unwrap();
test_entry(RaylibRender::auto_start(), replay);
}
fn test_entry(mut renderer: RaylibRender, replay: Vec<RenderCommandOutput<ExampleConfig>>) {
let mut pipe = CotisLayoutToRenderListPipeForGenerics;
let res: Vec<SimpleRenderCmds> = pipe.transform(replay.into_iter()).collect();
let font_path = example_path("examples/fonts/Roboto-Regular.ttf");
let _font = renderer
.load_font_ex_and_keep(
font_path.to_str().expect("font path must be valid UTF-8"),
24,
None,
Some(TextureFilter::TEXTURE_FILTER_BILINEAR),
)
.unwrap();
while !renderer.window_should_close() {
renderer.draw_frame(res.clone().into_iter());
}
}