pub use crate::ecs::world::Render;

pub async fn create_renderer<W>(
    window_handle: W,
    initial_width: u32,
    initial_height: u32,
) -> std::result::Result<Box<dyn Render>, Box<dyn std::error::Error>>
where
    W: raw_window_handle::HasDisplayHandle
        + raw_window_handle::HasWindowHandle
        + Send
        + Sync
        + 'static,
{
    #[cfg(feature = "wgpu")]
    {
        let wgpu_renderer =
            crate::render::wgpu::create_wgpu_renderer(window_handle, initial_width, initial_height)
                .await?;
        Ok(Box::new(wgpu_renderer))
    }

    #[cfg(not(feature = "wgpu"))]
    {
        Err("No renderer backend enabled".into())
    }
}
