mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 18:10:14 +01:00
minor tweaks to examples
This commit is contained in:
parent
20ea1354be
commit
52080c0ad0
|
@ -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,
|
||||||
))
|
);
|
||||||
.expect("send failed");
|
connection.send(command).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);
|
||||||
|
|
|
@ -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,
|
||||||
))
|
);
|
||||||
.expect("could not send");
|
connection.send(command).expect("could not send");
|
||||||
thread::sleep(FRAME_PACING);
|
thread::sleep(FRAME_PACING);
|
||||||
field = iteration(field);
|
field = iteration(field);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue