minor tweaks to examples

This commit is contained in:
Vinzenz Schroeter 2024-06-25 22:10:48 +02:00
parent 20ea1354be
commit 52080c0ad0
3 changed files with 20 additions and 22 deletions

View file

@ -2,8 +2,8 @@
use clap::Parser;
use servicepoint::Command::BitmapLinearWin;
use servicepoint::*;
use servicepoint::Command::BitmapLinearWin;
#[derive(Parser, Debug)]
struct Cli {
@ -19,13 +19,12 @@ fn main() {
let mut pixels = PixelGrid::max_sized();
pixels.fill(true);
connection
.send(BitmapLinearWin(
let command = BitmapLinearWin(
Origin::new(0, 0),
pixels,
CompressionCode::Uncompressed,
))
.expect("send failed");
);
connection.send(command).expect("send failed");
let max_brightness = usize::from(u8::from(Brightness::MAX));
let mut brightnesses = BrightnessGrid::new(TILE_WIDTH, TILE_HEIGHT);

View file

@ -23,13 +23,12 @@ fn main() {
let mut field = make_random_field(cli.probability);
loop {
connection
.send(Command::BitmapLinearWin(
let command = Command::BitmapLinearWin(
Origin::new(0, 0),
field.clone(),
CompressionCode::Lzma,
))
.expect("could not send");
);
connection.send(command).expect("could not send");
thread::sleep(FRAME_PACING);
field = iteration(field);
}

View file

@ -23,13 +23,13 @@ fn main() {
for y in 0..PIXEL_HEIGHT {
pixels.set((y + x_offset) % PIXEL_WIDTH, y, true);
}
connection
.send(Command::BitmapLinearWin(
let command = Command::BitmapLinearWin(
Origin::new(0, 0),
pixels.clone(),
CompressionCode::Lzma,
))
.unwrap();
);
connection.send(command).expect("send failed");
thread::sleep(FRAME_PACING);
}
}