lower framerate if refresh for running commands

This commit is contained in:
Penwing 2024-02-02 19:16:52 +01:00
parent 98662a6c3f
commit bb35ce3295

View file

@ -29,6 +29,7 @@ const MAX_FPS: f32 = 30.0;
const DISPLAY_PATH_DEPTH: usize = 3; const DISPLAY_PATH_DEPTH: usize = 3;
const MAX_TABS: usize = 20; const MAX_TABS: usize = 20;
const MAX_PROJECT_COLUMNS: usize = 8; const MAX_PROJECT_COLUMNS: usize = 8;
const RUNNING_COMMAND_REFRESH_DELAY: f32 = 0.2;
fn main() -> Result<(), eframe::Error> { fn main() -> Result<(), eframe::Error> {
let icon_data = core::load_icon().unwrap_or_default(); let icon_data = core::load_icon().unwrap_or_default();
@ -265,9 +266,9 @@ impl eframe::App for Calcifer {
self.time_watch[6] = watch.elapsed().as_micros() as f32 / 1000.0; self.time_watch[6] = watch.elapsed().as_micros() as f32 / 1000.0;
if self.running_command { if self.running_command && !ctx.input(|i| i.wants_repaint()) {
thread::sleep(time::Duration::from_secs_f32(RUNNING_COMMAND_REFRESH_DELAY));
egui::Context::request_repaint(ctx); egui::Context::request_repaint(ctx);
//thread::sleep(time::Duration::from_secs_f32(RUNNING_COMMAND_REFRESH));
} }
} }