equal
deleted
inserted
replaced
5 pixels::{ |
5 pixels::{ |
6 PixelFormatEnum, Color |
6 PixelFormatEnum, Color |
7 } |
7 } |
8 }; |
8 }; |
9 |
9 |
10 use integral_geometry::Point; |
10 use integral_geometry::{Point, Size}; |
11 |
11 |
12 use rand::{ |
12 use rand::{ |
13 thread_rng, RngCore, Rng, |
13 thread_rng, RngCore, Rng, |
14 distributions::uniform::SampleUniform |
14 distributions::uniform::SampleUniform |
15 }; |
15 }; |
62 thread_rng().gen_range(T::default(), max) |
62 thread_rng().gen_range(T::default(), max) |
63 } |
63 } |
64 |
64 |
65 const WIDTH: u32 = 512; |
65 const WIDTH: u32 = 512; |
66 const HEIGHT: u32 = 512; |
66 const HEIGHT: u32 = 512; |
|
67 const SIZE: Size = Size {width: 512, height: 512}; |
67 |
68 |
68 fn main() { |
69 fn main() { |
69 let sdl = sdl2::init().unwrap(); |
70 let sdl = sdl2::init().unwrap(); |
70 let _image = sdl2::image::init(sdl2::image::INIT_PNG).unwrap(); |
71 let _image = sdl2::image::init(sdl2::image::INIT_PNG).unwrap(); |
71 let events = sdl.event().unwrap(); |
72 let events = sdl.event().unwrap(); |
80 |
81 |
81 fn point() -> Point { |
82 fn point() -> Point { |
82 Point::new(rnd(WIDTH as i32), rnd(HEIGHT as i32)) |
83 Point::new(rnd(WIDTH as i32), rnd(HEIGHT as i32)) |
83 } |
84 } |
84 |
85 |
85 let mut land = Land2D::new(WIDTH as usize, HEIGHT as usize, 0); |
86 let mut land = Land2D::new(SIZE, 0); |
86 for i in 0..32 { |
87 for i in 0..32 { |
87 land.draw_thick_line(point(), point(), rnd(5), u32::max_value()); |
88 land.draw_thick_line(point(), point(), rnd(5), u32::max_value()); |
88 |
89 |
89 land.fill_circle(point(), rnd(60), u32::max_value()); |
90 land.fill_circle(point(), rnd(60), u32::max_value()); |
90 } |
91 } |