mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/exe/map.rs')
| -rw-r--r-- | src/exe/map.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/exe/map.rs b/src/exe/map.rs new file mode 100644 index 0000000..13955cd --- /dev/null +++ b/src/exe/map.rs @@ -0,0 +1,22 @@ +use mindus::data::DataRead; +use mindus::{build_registry, Renderer}; +use mindus::{MapSerializer, Serializer}; +use std::env::Args; + +use super::print_err; +pub fn main(args: Args) { + let reg = build_registry(); + let mut ms = MapSerializer(®); + + // process schematics from command line + for curr in args { + if let Ok(s) = std::fs::read(curr) { + match ms.deserialize(&mut DataRead::new(&s)) { + Err(e) => print_err!(e, "fail"), + Ok(m) => { + Renderer::render_map(&m).save("x.png").unwrap(); + } + } + } + } +} |