game of life example, bug fixes

This commit is contained in:
Vinzenz Schroeter 2024-05-10 12:24:07 +02:00
parent a7b6cf2ad0
commit e6f8afb378
7 changed files with 439 additions and 20 deletions

View file

@ -1,17 +1,20 @@
use servicepoint2::{Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid, Size, TILE_WIDTH, Window};
use std::thread;
use std::time::Duration;
use servicepoint2::{Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid};
use servicepoint2::Command::BitmapLinearWin;
fn main() {
let connection = Connection::open("localhost:2342").unwrap();
let origin = Origin(0, 0);
let mut pixels = PixelGrid::max_sized();
for x_offset in 0..usize::MAX {
let mut pixels = PixelGrid::max_sized();
pixels.fill(false);
for y in 0..PIXEL_HEIGHT as usize {
pixels.set((y + x_offset) % PIXEL_WIDTH as usize, y, true);
}
let window = Window(Origin(0, 0), Size(TILE_WIDTH, PIXEL_HEIGHT));
connection.send(BitmapLinearWin(window, pixels)).unwrap();
connection.send(BitmapLinearWin(origin, pixels.clone())).unwrap();
thread::sleep(Duration::from_millis(14));
}
}