Diagonal data structure

This commit is contained in:
Luke D Jones
2021-04-04 23:46:21 +12:00
parent de59d00949
commit 226c083a51
4 changed files with 31 additions and 12 deletions

View File

@@ -4,19 +4,37 @@ use rog_dbus::AuraDbusClient;
// In usable data:
// Top row start at 1, ends at 32
// 74w x 36h diagonal used by the windows app
fn main() {
let (client, _) = AuraDbusClient::new().unwrap();
let mut matrix = AniMeGrid::new();
{
let tmp = matrix.get_mut();
for row in tmp.iter_mut() {
row[row.len() - 33] = 0xff;
let tmp = matrix.get_mut();
row[row.len() - 22] = 0xff;
let mut i = 0;
for (y, row) in tmp.iter_mut().enumerate() {
if y % 2 == 0 && i + 1 != row.len() -1 {
i += 1;
dbg!(i);
}
row[row.len() - i] = 0x22;
if i > 5{
row[row.len() - i + 5] = 0x22;
}
if i > 10 {
row[row.len() - i + 10] = 0x22;
}
row[row.len() - 11] = 0xff;
if i > 15 {
row[row.len() - i + 15] = 0x22;
}
row[row.len() - 1] = 0xff;
if i > 20 {
row[row.len() - i + 20] = 0x22;
}
if i > 25 {
row[row.len() - i + 25] = 0x22;
}
}

View File

@@ -79,10 +79,8 @@ pub struct AniMeImage {
pub help: bool,
#[options(meta = "", help = "full path to the png to display")]
pub path: String,
#[options(meta = "", default = "0.0", help = "x scale 0.0-1.0")]
pub x_scale: f32,
#[options(meta = "", default = "0.0", help = "y scale 0.0-1.0")]
pub y_scale: f32,
#[options(meta = "", default = "1.0", help = "scale 1.0 == normal")]
pub scale: f32,
#[options(meta = "", default = "0.0", help = "x position (float)")]
pub x_pos: f32,
#[options(meta = "", default = "0.0", help = "y position (float)")]

View File

@@ -180,7 +180,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let matrix = AnimeImage::from_png(
Path::new(&image.path),
Vec2::new(image.x_scale, image.y_scale),
Vec2::new(image.scale, image.scale),
image.angle,
Vec2::new(image.x_pos, image.y_pos),
image.bright,

View File

@@ -11,5 +11,8 @@ pub use anime_grid::*;
mod anime_image;
pub use anime_image::*;
mod anime_diagonal;
pub use anime_diagonal::*;
/// Base errors that are possible
pub mod error;