fix examples

This commit is contained in:
Vinzenz Schroeter 2024-05-18 15:49:22 +02:00
parent b21040c1f3
commit 1fe7760ee2
3 changed files with 13 additions and 14 deletions

View file

@ -19,8 +19,8 @@ fn main() {
for x_offset in 0..usize::MAX {
pixels.fill(false);
for y in 0..PIXEL_HEIGHT as usize {
pixels.set((y + x_offset) % PIXEL_WIDTH as usize, y, true);
for y in 0..PIXEL_HEIGHT {
pixels.set((y + x_offset) % PIXEL_WIDTH, y, true);
}
connection
.send(

View file

@ -40,17 +40,17 @@ fn main() {
// continuously update random windows to new random brightness
loop {
let min_size = 1;
let x: u16 = rng.gen_range(0..TILE_WIDTH - min_size);
let y: u16 = rng.gen_range(0..TILE_HEIGHT - min_size);
let x = rng.gen_range(0..TILE_WIDTH - min_size);
let y = rng.gen_range(0..TILE_HEIGHT - min_size);
let w: u16 = rng.gen_range(min_size..=TILE_WIDTH - x);
let h: u16 = rng.gen_range(min_size..=TILE_HEIGHT - y);
let w = rng.gen_range(min_size..=TILE_WIDTH - x);
let h = rng.gen_range(min_size..=TILE_HEIGHT - y);
let origin = Origin(x, y);
let mut luma = ByteGrid::new(w as usize, h as usize);
let mut luma = ByteGrid::new(w, h);
for y in 0..h as usize {
for x in 0..w as usize {
for y in 0..h {
for x in 0..w {
luma.set(x, y, rng.gen());
}
}

View file

@ -24,13 +24,12 @@ fn main() {
let connection = Connection::open(cli.destination).unwrap();
let mut enabled_pixels =
PixelGrid::new(PIXEL_WIDTH as usize, PIXEL_HEIGHT as usize);
let mut enabled_pixels = PixelGrid::new(PIXEL_WIDTH, PIXEL_HEIGHT);
enabled_pixels.fill(true);
for x_offset in 0..PIXEL_WIDTH as usize {
for y in 0..PIXEL_HEIGHT as usize {
enabled_pixels.set(x_offset % PIXEL_WIDTH as usize, y, false);
for x_offset in 0..PIXEL_WIDTH {
for y in 0..PIXEL_HEIGHT {
enabled_pixels.set(x_offset % PIXEL_WIDTH, y, false);
}
// this works because the pixel grid has max size