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 clap::Parser;
use servicepoint::Command::BitmapLinearWin;
use servicepoint::*; use servicepoint::*;
use servicepoint::Command::BitmapLinearWin;
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
struct Cli { struct Cli {
@ -19,13 +19,12 @@ fn main() {
let mut pixels = PixelGrid::max_sized(); let mut pixels = PixelGrid::max_sized();
pixels.fill(true); pixels.fill(true);
connection let command = BitmapLinearWin(
.send(BitmapLinearWin( Origin::new(0, 0),
Origin::new(0, 0), pixels,
pixels, CompressionCode::Uncompressed,
CompressionCode::Uncompressed, );
)) connection.send(command).expect("send failed");
.expect("send failed");
let max_brightness = usize::from(u8::from(Brightness::MAX)); let max_brightness = usize::from(u8::from(Brightness::MAX));
let mut brightnesses = BrightnessGrid::new(TILE_WIDTH, TILE_HEIGHT); 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); let mut field = make_random_field(cli.probability);
loop { loop {
connection let command = Command::BitmapLinearWin(
.send(Command::BitmapLinearWin( Origin::new(0, 0),
Origin::new(0, 0), field.clone(),
field.clone(), CompressionCode::Lzma,
CompressionCode::Lzma, );
)) connection.send(command).expect("could not send");
.expect("could not send");
thread::sleep(FRAME_PACING); thread::sleep(FRAME_PACING);
field = iteration(field); field = iteration(field);
} }

View file

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