use cotis::cotis_app::{CotisApp, RenderApp, UiFn};
use cotis::utils::ElementIdConfig;
use cotis_defaults::colors::Color;
use cotis_defaults::element_configs::premade_configs::GenericElementConfig;
use cotis_defaults::element_configs::style::CotisStyle;
use cotis_defaults::render_commands::render_t_list::RenderTList;
use cotis_defaults::render_commands::{Border, ClipEnd, ClipStart, Rectangle, Text};
use cotis_layout::layout_struct::RenderCommandOutput;
use cotis_layout::preamble::CotisLayoutManager;
use cotis_pipes::cotis_layout_pipes::CotisLayoutToRenderListPipeForGenerics;
use cotis_wgpu::CotisWgpuRenderer;
#[cfg(feature = "complex-color")]
use cotis_defaults::colors::ColorLayer;
#[cfg(not(feature = "complex-color"))]
pub type FillColor = Color;
#[cfg(feature = "complex-color")]
pub type FillColor = ColorLayer;
pub fn solid_color(r: f32, g: f32, b: f32, a: f32) -> FillColor {
let color = Color::rgba(r, g, b, a);
#[cfg(not(feature = "complex-color"))]
{
color
}
#[cfg(feature = "complex-color")]
{
ColorLayer::Solid(color)
}
}
pub type ExampleConfig = GenericElementConfig<'static, (), ()>;
pub type StandardRenderCmds = RenderTList<
ClipStart<'static, ()>,
RenderTList<
ClipEnd,
RenderTList<
Rectangle<'static, ()>,
RenderTList<Border<'static, ()>, RenderTList<Text<'static, ()>, ()>>,
>,
>,
>;
pub type ExampleCotisApp =
CotisApp<CotisWgpuRenderer, CotisLayoutManager, CotisLayoutToRenderListPipeForGenerics>;
pub fn empty_example_config() -> ExampleConfig {
ExampleConfig {
id_config: ElementIdConfig::new_empty(),
style: CotisStyle::default(),
image: None,
custom: None,
extra_data: None,
}
}
pub fn compute_frame<'layout, Cmds, Ui>(app: &'layout mut ExampleCotisApp, ui: Ui)
where
CotisWgpuRenderer: cotis::renders::CotisRenderer<Cmds>,
CotisLayoutToRenderListPipeForGenerics:
cotis::pipes::LayoutRenderPipe<RenderCommandOutput<ExampleConfig>, Cmds>,
Ui: for<'a> UiFn<
'a,
cotis_layout::preamble::CotisLayoutRun<'layout, ExampleConfig>,
ExampleConfig,
>,
{
RenderApp::<
ExampleConfig,
RenderCommandOutput<ExampleConfig>,
Cmds,
CotisWgpuRenderer,
CotisLayoutManager,
>::compute_frame(app, ui);
}