equal
deleted
inserted
replaced
|
1 pub mod theme; |
|
2 |
1 use std::{ |
3 use std::{ |
2 collections::hash_map::HashMap, |
4 collections::hash_map::HashMap, |
3 borrow::Borrow, |
5 borrow::Borrow, |
4 mem::replace |
6 mem::replace |
5 }; |
7 }; |
9 use integral_geometry::{Point, Size, Rect}; |
11 use integral_geometry::{Point, Size, Rect}; |
10 use landgen::{ |
12 use landgen::{ |
11 outline_template::OutlineTemplate |
13 outline_template::OutlineTemplate |
12 }; |
14 }; |
13 use rand::{thread_rng, Rng}; |
15 use rand::{thread_rng, Rng}; |
|
16 use land2d::Land2D; |
|
17 use theme::Theme; |
14 |
18 |
15 #[derive(Deserialize)] |
19 #[derive(Deserialize)] |
16 struct PointDesc { |
20 struct PointDesc { |
17 x: u32, |
21 x: u32, |
18 y: u32 |
22 y: u32 |
99 } |
103 } |
100 |
104 |
101 pub fn get_template(&self, template_type: &str) -> Option<&OutlineTemplate> { |
105 pub fn get_template(&self, template_type: &str) -> Option<&OutlineTemplate> { |
102 self.templates.get(template_type).and_then(|t| thread_rng().choose(t)) |
106 self.templates.get(template_type).and_then(|t| thread_rng().choose(t)) |
103 } |
107 } |
|
108 |
|
109 pub fn make_texture(&self, land: &Land2D<u32>, theme: &Theme) { |
|
110 |
|
111 } |
104 } |
112 } |
105 |
113 |
106 #[cfg(test)] |
114 #[cfg(test)] |
107 mod tests { |
115 mod tests { |
108 use crate::{ |
116 use crate::{ |