mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/exe/draw.rs')
-rw-r--r--src/exe/draw.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/exe/draw.rs b/src/exe/draw.rs
new file mode 100644
index 0000000..964bcac
--- /dev/null
+++ b/src/exe/draw.rs
@@ -0,0 +1,24 @@
+use mindus::build_registry;
+use mindus::Renderable;
+use mindus::SchematicSerializer;
+use std::env::Args;
+
+use crate::print_err;
+
+pub fn main(args: Args) {
+ let reg = build_registry();
+ let mut ss = SchematicSerializer(&reg);
+
+ // process schematics from command line
+ for curr in args {
+ match ss.deserialize_base64(&curr) {
+ Ok(s) => {
+ s.render().save("x.png");
+ }
+ // continue processing literals & maybe interactive mode
+ Err(e) => {
+ print_err!(e, "Could not read schematic");
+ }
+ }
+ }
+}