2023-01-27 05:55:12 +01:00
|
|
|
#[derive(PartialEq, Eq, Debug)]
|
|
|
|
pub enum OutputMode {
|
|
|
|
Binary,
|
|
|
|
Color,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Data {
|
|
|
|
pub bytes: Vec<u8>,
|
|
|
|
pub binary: Vec<bool>,
|
|
|
|
pub out_mode: OutputMode,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Data {
|
2023-01-28 07:25:49 +01:00
|
|
|
pub fn new_out_mode(out_mode: OutputMode) -> Data {
|
|
|
|
Data {
|
|
|
|
bytes: Vec::new(),
|
|
|
|
binary: Vec::new(),
|
|
|
|
out_mode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn from_binary(binary: Vec<bool>) -> Data {
|
2023-01-27 05:55:12 +01:00
|
|
|
Data {
|
|
|
|
bytes: Vec::new(),
|
|
|
|
binary,
|
|
|
|
out_mode: OutputMode::Binary,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn from_color(bytes: Vec<u8>) -> Data {
|
|
|
|
Data {
|
|
|
|
bytes,
|
|
|
|
binary: Vec::new(),
|
|
|
|
out_mode: OutputMode::Color,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Settings {
|
|
|
|
pub size: i32,
|
|
|
|
pub fps: f64,
|
|
|
|
pub width: i32,
|
|
|
|
pub height: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Settings {
|
|
|
|
pub fn new(size: i32, fps: i32, width: i32, height: i32,)
|
|
|
|
-> Settings {
|
2023-01-28 07:25:49 +01:00
|
|
|
Settings {
|
|
|
|
size,
|
|
|
|
fps: fps as f64,
|
|
|
|
height,
|
|
|
|
width
|
|
|
|
}
|
2023-01-27 05:55:12 +01:00
|
|
|
}
|
|
|
|
}
|