top to bottom fill
This commit is contained in:
parent
1e6b95e21b
commit
91b41bc913
1 changed files with 12 additions and 5 deletions
17
src/main.rs
17
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<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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue