From 7412eb082f715b5563b92d98df9d7873af1918a3 Mon Sep 17 00:00:00 2001 From: yuni Date: Thu, 10 Oct 2024 01:23:04 +0200 Subject: [PATCH] reduce power usage when window is defocused --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index 0ae71a4..3a5033f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,6 +115,14 @@ fn main() { mode: bevy_embedded_assets::PluginMode::ReplaceDefault, }); + // Reduce power usage when unfocused + app.insert_resource(bevy::winit::WinitSettings { + focused_mode: bevy::winit::UpdateMode::Continuous, + unfocused_mode: bevy::winit::UpdateMode::reactive_low_power( + bevy::utils::Duration::from_secs(10), + ), + }); + app.add_plugins(OutFlyPlugin); app.insert_resource(prefs); app.run();