2024-05-10 12:24:07 +02:00
|
|
|
use std::thread;
|
|
|
|
use std::time::Duration;
|
2024-05-10 18:51:03 +02:00
|
|
|
use clap::Parser;
|
2024-05-10 12:24:07 +02:00
|
|
|
use servicepoint2::{Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid};
|
2024-05-10 01:00:30 +02:00
|
|
|
use servicepoint2::Command::BitmapLinearWin;
|
|
|
|
|
2024-05-10 18:51:03 +02:00
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
struct Cli {
|
|
|
|
#[arg(short, long, default_value = "localhost:2342")]
|
|
|
|
destination: String,
|
|
|
|
}
|
|
|
|
|
2024-05-10 01:00:30 +02:00
|
|
|
fn main() {
|
2024-05-10 18:51:03 +02:00
|
|
|
let cli = Cli::parse();
|
|
|
|
println!("starting with args: {:?}", &cli);
|
|
|
|
let connection = Connection::open(cli.destination).unwrap();
|
2024-05-10 01:00:30 +02:00
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|