From 91b41bc913104513712da39d882d5a4e3a38bd43 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Sat, 28 Oct 2023 20:40:57 -0500 Subject: [PATCH] top to bottom fill --- src/main.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 734fa91..9e4db43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,9 +6,9 @@ fn main() -> Result<()> { let pf = PlayerFinder::new()?; let players = pf.find_all()?; - let mut tracker = players[0].track_progress(500)?; + let mut tracker = players[0].track_progress(1000/20)?; - let icon = IconSource::Data{data: gen_icon(0), height: 32, width: 32}; + let icon = IconSource::Data{data: gen_icon(0), height: RES, width: RES}; let mut tray = TrayItem::new("funring", icon)?; @@ -22,16 +22,23 @@ fn main() -> Result<()> { println!("{prog}"); tray.set_icon( - IconSource::Data{data: gen_icon(prog as u8), height: 32, width: 32} + IconSource::Data{data: gen_icon(prog as u8), height: RES, width: RES} )?; } } +const RES: i32 = 64; + fn gen_icon(red: u8) -> Vec { let mut icon = Vec::new(); - for pix in 0..(32*32) { + for pix in 0..(RES*RES) { icon.push(1); - icon.push(red); + icon.push( + if red as f32 > (pix as f32 / (RES * RES) as f32 * 256.0) { + red + } else { + 0 + }); icon.push(0); icon.push(0); }