#![allow(clippy::too_many_arguments, clippy::type_complexity)]
#![warn(missing_docs)]
pub mod animation;
pub mod asset;
mod button;
mod camera;
pub mod cursor;
pub mod filter;
mod image;
#[cfg(feature = "line")]
mod line;
#[cfg(feature = "map")]
mod map;
pub mod math;
pub mod palette;
#[cfg(feature = "particle")]
mod particle;
mod pixel;
pub mod position;
pub mod prelude;
pub mod screen;
pub mod set;
pub mod sprite;
mod text;
mod ui;
use std::{marker::PhantomData, path::PathBuf};
use animation::animation_plugin;
use asset::asset_plugin;
use button::button_plugin;
use camera::camera_plugin;
use cursor::cursor_plugin;
use palette::palette_plugin;
#[cfg(feature = "particle")]
use particle::particle_plugin;
use position::{position_plugin, PxLayer};
use prelude::*;
use screen::screen_plugin;
use seldom_fn_plugin::FnPluginExt;
#[derive(Debug)]
pub struct PxPlugin<L: PxLayer> {
screen_size: UVec2,
palette_path: PathBuf,
_l: PhantomData<L>,
}
impl<L: PxLayer> Plugin for PxPlugin<L> {
fn build(&self, app: &mut App) {
app.fn_plugin(px_plugin::<L>(self.screen_size, self.palette_path.clone()));
}
}
impl<L: PxLayer> PxPlugin<L> {
pub fn new(screen_size: UVec2, palette_path: PathBuf) -> Self {
Self {
screen_size,
palette_path,
_l: default(),
}
}
}
pub fn px_plugin<L: PxLayer>(screen_size: UVec2, palette_path: PathBuf) -> impl FnOnce(&mut App) {
move |app| {
app.fn_plugin(animation_plugin)
.fn_plugin(asset_plugin)
.fn_plugin(button_plugin)
.fn_plugin(camera_plugin)
.fn_plugin(palette_plugin(palette_path))
.fn_plugin(position_plugin)
.fn_plugin(screen_plugin::<L>(screen_size))
.fn_plugin(cursor_plugin);
#[cfg(feature = "particle")]
app.add_plugins(RngPlugin::default())
.fn_plugin(particle_plugin::<L>);
}
}