feat(exporters): scaffold PngExporter
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
mod image_export;
|
||||
mod litematica;
|
||||
mod mcfunction;
|
||||
|
||||
use lib::{BlockPalette, StructureExporter};
|
||||
|
||||
pub use image_export::PngExporter;
|
||||
pub use litematica::LitematicaExporter;
|
||||
pub use mcfunction::McFunctionExporter;
|
||||
|
||||
@@ -11,12 +13,17 @@ type ExporterFactory = fn(&BlockPalette) -> Box<dyn StructureExporter>;
|
||||
const REGISTRY: &[(&str, ExporterFactory)] = &[
|
||||
("mcfunction", |p| Box::new(McFunctionExporter::new(p))),
|
||||
("litematica", |p| Box::new(LitematicaExporter::new(p))),
|
||||
("png", |p| Box::new(PngExporter::new(p, 16))),
|
||||
];
|
||||
|
||||
pub fn available_names() -> Vec<&'static str> {
|
||||
REGISTRY.iter().map(|(name, _)| *name).collect()
|
||||
}
|
||||
|
||||
pub fn build_png(palette: &BlockPalette, cell_size: u32) -> Box<dyn StructureExporter> {
|
||||
Box::new(PngExporter::new(palette, cell_size))
|
||||
}
|
||||
|
||||
pub fn build(name: &str, palette: &BlockPalette) -> Option<Box<dyn StructureExporter>> {
|
||||
REGISTRY.iter()
|
||||
.find(|(n, _)| *n == name)
|
||||
|
||||
Reference in New Issue
Block a user