add basic land template to theme editor
authoralfadur
Fri, 02 Nov 2018 22:55:15 +0300
changeset 14103 a8e194ae26e8
parent 14102 400864ecb954
child 14104 7845beb87cb5
add basic land template to theme editor
rust/theme-editor/src/main.rs
--- a/rust/theme-editor/src/main.rs	Fri Nov 02 22:50:45 2018 +0300
+++ b/rust/theme-editor/src/main.rs	Fri Nov 02 22:55:15 2018 +0300
@@ -76,10 +76,18 @@
     Rect::new(rnd(WIDTH as i32), rnd(HEIGHT as i32), rnd(120) + 8, rnd(120) + 8)
 }
 
+fn land_rect() -> Rect {
+    Rect::at_origin(SIZE)
+}
+
+fn test_template() -> OutlineTemplate {
+    OutlineTemplate::new(SIZE)
+        .with_fill_points(vec![land_rect().center()])
+        .add_island(&land_rect().split_at(land_rect().center()))
+}
+
 fn init_source() -> LandSource<TemplatedLandGenerator> {
-    let template = OutlineTemplate::new(SIZE)
-        .with_fill_points((0..32).map(|_| point()).collect())
-        .with_islands((0..16).map(|_| vec![rect()]).collect());
+    let template = test_template();
 
     let generator = TemplatedLandGenerator::new(template);
     LandSource::new(generator)