mirror of
https://github.com/talwat/lowfi
synced 2026-10-30 15:04:58 +00:00
fix: small bug with progress bar
This commit is contained in:
parent
d86a51e933
commit
f5d894a27f
7
data/sfx.txt
Normal file
7
data/sfx.txt
Normal file
@ -0,0 +1,7 @@
|
||||
noheader
|
||||
https://sfxmint.com/dl/door-open-50.mp3
|
||||
https://sfxmint.com/dl/door-open-10.mp3
|
||||
https://sfxmint.com/dl/feedback-buzzer-20.mp3
|
||||
https://sfxmint.com/dl/retro-game-explosion-54.mp3
|
||||
https://sfxmint.com/dl/retro-game-explosion-51.mp3
|
||||
https://sfxmint.com/dl/gore-squish-02.mp3
|
||||
@ -30,8 +30,12 @@ pub fn progress_bar(state: &ui::State, width: usize) -> String {
|
||||
if let Some(x) = current.duration {
|
||||
duration = x;
|
||||
|
||||
let elapsed = elapsed.as_secs() as f32 / duration.as_secs() as f32;
|
||||
filled = (elapsed * width as f32).round() as usize;
|
||||
let elapsed = elapsed
|
||||
.as_secs_f32()
|
||||
.round()
|
||||
.clamp(0.0, duration.as_secs_f32());
|
||||
let ratio = (elapsed / duration.as_secs_f32()).clamp(0.0, 1.0);
|
||||
filled = (ratio * width as f32).round() as usize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,9 +4,7 @@
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use souvlaki::{
|
||||
MediaControlEvent, MediaControls, MediaMetadata, MediaPlayback, PlatformConfig,
|
||||
};
|
||||
use souvlaki::{MediaControlEvent, MediaControls, MediaMetadata, MediaPlayback, PlatformConfig};
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
|
||||
use crate::player::Current;
|
||||
@ -164,8 +162,8 @@ mod windows {
|
||||
use ::windows::Win32::System::LibraryLoader::GetModuleHandleW;
|
||||
use ::windows::Win32::UI::WindowsAndMessaging::{
|
||||
CreateWindowExW, DefWindowProcW, DestroyWindow, DispatchMessageW, PeekMessageW,
|
||||
RegisterClassExW, TranslateMessage, MSG, PM_REMOVE, WINDOW_EX_STYLE, WINDOW_STYLE,
|
||||
WM_QUIT, WNDCLASSEXW,
|
||||
RegisterClassExW, TranslateMessage, MSG, PM_REMOVE, WINDOW_EX_STYLE, WINDOW_STYLE, WM_QUIT,
|
||||
WNDCLASSEXW,
|
||||
};
|
||||
|
||||
pub struct DummyWindow {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user