add c api
This commit is contained in:
parent
01d1f1dad0
commit
98e8a6d639
14 changed files with 832 additions and 23 deletions
|
@ -4,8 +4,7 @@ use std::time::Duration;
|
|||
use clap::Parser;
|
||||
use rand::{distributions, Rng};
|
||||
|
||||
use servicepoint2::{Connection, Origin, PixelGrid};
|
||||
use servicepoint2::Command::BitmapLinearWin;
|
||||
use servicepoint2::{Command, Connection, Origin, PixelGrid};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Cli {
|
||||
|
@ -24,7 +23,7 @@ fn main() {
|
|||
|
||||
loop {
|
||||
connection
|
||||
.send(BitmapLinearWin(Origin::top_left(), field.clone()))
|
||||
.send(Command::BitmapLinearWin(Origin::top_left(), field.clone()))
|
||||
.expect("could not send");
|
||||
thread::sleep(Duration::from_millis(14));
|
||||
field = iteration(field);
|
||||
|
|
|
@ -3,8 +3,7 @@ use std::time::Duration;
|
|||
|
||||
use clap::Parser;
|
||||
|
||||
use servicepoint2::Command::BitmapLinearWin;
|
||||
use servicepoint2::{Connection, Origin, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH};
|
||||
use servicepoint2::{Command, Connection, Origin, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct Cli {
|
||||
|
@ -25,7 +24,7 @@ fn main() {
|
|||
pixels.set((y + x_offset) % PIXEL_WIDTH as usize, y, true);
|
||||
}
|
||||
connection
|
||||
.send(BitmapLinearWin(Origin::top_left(), pixels.clone()))
|
||||
.send(Command::BitmapLinearWin(Origin::top_left(), pixels.clone()))
|
||||
.unwrap();
|
||||
thread::sleep(Duration::from_millis(14));
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@ use std::time::Duration;
|
|||
|
||||
use clap::Parser;
|
||||
|
||||
use servicepoint2::Command::BitmapLinearAnd;
|
||||
use servicepoint2::{
|
||||
BitVec, CompressionCode, Connection, PixelGrid, PIXEL_HEIGHT, PIXEL_WIDTH,
|
||||
BitVec, Command, CompressionCode, Connection, PIXEL_HEIGHT, PIXEL_WIDTH, PixelGrid
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
|
@ -37,7 +36,7 @@ fn main() {
|
|||
let bit_vec = BitVec::from(&*pixel_data);
|
||||
|
||||
connection
|
||||
.send(BitmapLinearAnd(0, bit_vec, CompressionCode::Gz))
|
||||
.send(Command::BitmapLinearAnd(0, bit_vec, CompressionCode::Gz))
|
||||
.unwrap();
|
||||
thread::sleep(sleep_duration);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue