rust/theme-editor/src/main.rs
changeset 14119 a8e194ae26e8
parent 14111 43d956f41cd4
child 14120 7845beb87cb5
equal deleted inserted replaced
14118:400864ecb954 14119:a8e194ae26e8
    74 }
    74 }
    75 fn rect() -> Rect {
    75 fn rect() -> Rect {
    76     Rect::new(rnd(WIDTH as i32), rnd(HEIGHT as i32), rnd(120) + 8, rnd(120) + 8)
    76     Rect::new(rnd(WIDTH as i32), rnd(HEIGHT as i32), rnd(120) + 8, rnd(120) + 8)
    77 }
    77 }
    78 
    78 
       
    79 fn land_rect() -> Rect {
       
    80     Rect::at_origin(SIZE)
       
    81 }
       
    82 
       
    83 fn test_template() -> OutlineTemplate {
       
    84     OutlineTemplate::new(SIZE)
       
    85         .with_fill_points(vec![land_rect().center()])
       
    86         .add_island(&land_rect().split_at(land_rect().center()))
       
    87 }
       
    88 
    79 fn init_source() -> LandSource<TemplatedLandGenerator> {
    89 fn init_source() -> LandSource<TemplatedLandGenerator> {
    80     let template = OutlineTemplate::new(SIZE)
    90     let template = test_template();
    81         .with_fill_points((0..32).map(|_| point()).collect())
       
    82         .with_islands((0..16).map(|_| vec![rect()]).collect());
       
    83 
    91 
    84     let generator = TemplatedLandGenerator::new(template);
    92     let generator = TemplatedLandGenerator::new(template);
    85     LandSource::new(generator)
    93     LandSource::new(generator)
    86 }
    94 }
    87 
    95