--- /dev/null
+mod geometry;
+pub use common::geometry::Point2D;
+pub use common::geometry::Rect;
+pub use common::geometry::Radians;
+pub use common::geometry::Degrees;
+
+mod time;
+pub use common::time::ScopeTimer;
--- /dev/null
+use std::time::Instant;
+
+pub struct ScopeTimer {
+ #[allow(dead_code)]
+ start: Instant,
+ #[allow(dead_code)]
+ name: &'static str,
+}
+
+impl ScopeTimer {
+ pub fn new(name: &'static str) -> Self {
+ ScopeTimer { start: Instant::now(), name: name }
+ }
+}
+
+#[cfg(debug_assertions)]
+impl Drop for ScopeTimer {
+ fn drop(&mut self) {
+ println!("{} took {:?}", self.name, self.start.elapsed());
+ }
+}
+
+#[macro_export]
+macro_rules! time_scope {
+ () => {
+ use common::ScopeTimer;
+ let _magical_scope_timer_ = ScopeTimer::new("scope");
+ };
+ ( $name:expr ) => {
+ use common::ScopeTimer;
+ let _magical_scope_timer_ = ScopeTimer::new($name);
+ };
+}
use common::Point2D;
+use ::{point, time_scope};
use core::render::Renderer;
use noise::{NoiseFn, OpenSimplex, Seedable};
use rand::Rng;
impl Grid {
fn generate(iterations: u8) -> Grid {
+ time_scope!("grid generation");
+
let cell_size = 20;
let (width, height) = (2560 / cell_size, 1440 / cell_size);
}
fn find_regions(&self) -> Vec<Region> {
+ time_scope!("finding all regions");
let mut regions = vec!();
let mut marked = vec!(vec!(false; self.height); self.width);
for x in 0..self.width {