servicepoint-binding-ruby/examples/moving_line/src/main.rs

21 lines
646 B
Rust
Raw Normal View History

2024-05-10 12:24:07 +02:00
use std::thread;
use std::time::Duration;
use servicepoint2::{Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid};
2024-05-10 01:00:30 +02:00
use servicepoint2::Command::BitmapLinearWin;
fn main() {
let connection = Connection::open("localhost:2342").unwrap();
2024-05-10 12:24:07 +02:00
let origin = Origin(0, 0);
let mut pixels = PixelGrid::max_sized();
2024-05-10 01:00:30 +02:00
for x_offset in 0..usize::MAX {
2024-05-10 12:24:07 +02:00
pixels.fill(false);
2024-05-10 01:00:30 +02:00
for y in 0..PIXEL_HEIGHT as usize {
pixels.set((y + x_offset) % PIXEL_WIDTH as usize, y, true);
}
2024-05-10 12:24:07 +02:00
connection.send(BitmapLinearWin(origin, pixels.clone())).unwrap();
thread::sleep(Duration::from_millis(14));
2024-05-10 01:00:30 +02:00
}
}