game of life example, bug fixes
This commit is contained in:
parent
a7b6cf2ad0
commit
e6f8afb378
7 changed files with 439 additions and 20 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue