1
Fork 0

top to bottom fill

This commit is contained in:
Andy Killorin 2023-10-28 20:40:57 -05:00
parent 1e6b95e21b
commit 91b41bc913
Signed by: ank
GPG key ID: B6241CA3B552BCA4

View file

@ -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<u8> {
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);
}