use std::marker::PhantomData;
use amethyst_core::{
bundle::SystemBundle,
ecs::{DispatcherBuilder, World},
};
use amethyst_error::Error;
use derive_new::new;
use crate::{types::Backend, RenderingBundle};
#[derive(Debug, new)]
pub struct RenderTestBundle<B>(PhantomData<B>);
impl<'a, 'b, B> SystemBundle<'a, 'b> for RenderTestBundle<B>
where
B: Backend,
{
fn build(
self,
world: &mut World,
builder: &mut DispatcherBuilder<'a, 'b>,
) -> Result<(), Error> {
let mut bundle =
RenderingBundle::<B>::new().with_plugin(crate::plugins::RenderFlat2D::default());
#[cfg(feature = "window")]
bundle.add_plugin(crate::plugins::RenderToWindow::from_config(
amethyst_window::DisplayConfig {
visibility: false,
..Default::default()
},
));
bundle.build(world, builder)?;
Ok(())
}
}
#[derive(Debug, new)]
pub struct RenderEmptyBundle<B>(PhantomData<B>);
impl<'a, 'b, B> SystemBundle<'a, 'b> for RenderEmptyBundle<B>
where
B: Backend,
{
fn build(
self,
world: &mut World,
builder: &mut DispatcherBuilder<'a, 'b>,
) -> Result<(), Error> {
let bundle = RenderingBundle::<B>::new();
bundle.build(world, builder)?;
Ok(())
}
}