use put_pixel

This commit is contained in:
mehbark 2025-03-11 21:28:04 -04:00
parent 00607122dd
commit f3ec466003

View file

@ -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());
}
}
}