servicepoint-binding-csharp/examples/moving_line/src/main.rs
Vinzenz Schroeter 8307354a58 cargo fmt
2024-05-16 23:18:43 +02:00

42 lines
988 B
Rust

use std::thread;
use std::time::Duration;
use clap::Parser;
use servicepoint2::{
Command, CompressionCode, Connection, Origin, PixelGrid, PIXEL_HEIGHT,
PIXEL_WIDTH,
};
#[derive(Parser, Debug)]
struct Cli {
#[arg(short, long, default_value = "localhost:2342")]
destination: String,
}
fn main() {
env_logger::init();
let connection = Connection::open(Cli::parse().destination).unwrap();
let mut pixels = PixelGrid::max_sized();
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);
}
connection
.send(
Command::BitmapLinearWin(
Origin::top_left(),
pixels.clone(),
CompressionCode::Lzma,
)
.into(),
)
.unwrap();
thread::sleep(Duration::from_millis(14));
}
}