From f3ec466003a40fa3b98e834fdd1ad435faf3937b Mon Sep 17 00:00:00 2001 From: mehbark <terezi@pyrope.net> Date: Tue, 11 Mar 2025 21:28:04 -0400 Subject: [PATCH] use put_pixel --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 4978703..8625995 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,9 +38,11 @@ fn main() { let step_digits = format!("{steps}").len(); for i in 0..steps { rng.fill_bytes(&mut rolls); + let GameStep { old, new } = game.step(last, &mut rng, &rolls); game = new; last = old; + game.write_to_buffer(&mut buffer); let path = format!("{output_prefix}{i:0OUTPUT_DIGITS$}.png"); @@ -48,6 +50,7 @@ fn main() { eprintln!("error saving image: {e}"); process::exit(1); } + eprintln!("step {:step_digits$}/{steps}", i + 1); } } @@ -151,7 +154,7 @@ impl Game { assert_eq!(self.height as u32, buffer.height()); for x in 0..self.width { for y in 0..self.height { - buffer[(x as u32, y as u32)] = self.at(x, y).unwrap().color(); + buffer.put_pixel(x as u32, y as u32, self.at(x, y).unwrap().color()); } } }