summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2020-07-27 13:23:32 +0200
committerTom Barrett <tom@tombarrett.xyz>2020-07-27 13:23:32 +0200
commite9fb787775f95dc80084c7c382937e2bfc31dd9e (patch)
treeeb988b9b6a887d9669d451eb066be3158928d6b3
parent4b1c0785a145b35affaf6ec4d6e35363e8fce383 (diff)
fixed rendering issues
-rw-r--r--src/main.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 20b9c9c..51a6ed9 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -40,7 +40,6 @@ fn main() {
canvas.present();
let (x, y) = find_origin();
- let delay = 50;
let mut lines = Vec::new();
for i in (0..(height as i16 + 1)).step_by(50) {
lines.push(Line {
@@ -72,8 +71,8 @@ fn main() {
let mut rng = rand::thread_rng();
lines.shuffle(&mut rng);
- let a = rng.gen_range(-10.0, 10.0);
- let b = rng.gen_range(-10.0, 10.0);
+ let a = rng.gen_range(-5.0, 5.0);
+ let b = rng.gen_range(-5.0, 5.0);
let mut pixels = Vec::new();
for i in (1000..200000).step_by(10) {
@@ -106,17 +105,16 @@ fn main() {
Color::RGB(255, 255, 255),
)
.unwrap();
- canvas.present();
- thread::sleep(Duration::from_millis(delay));
}
if i < pixels.len() {
let pixel = &pixels[i];
canvas
.pixel(pixel.x, pixel.y, Color::RGB(255, 255, 255))
.unwrap();
- canvas.present();
}
+ canvas.present();
+ thread::sleep(Duration::from_millis(10));
i += 1;
}
}