reduce power usage when window is defocused

This commit is contained in:
yuni 2024-10-10 01:23:04 +02:00
parent de9b8d99e8
commit 7412eb082f

View file

@ -115,6 +115,14 @@ fn main() {
mode: bevy_embedded_assets::PluginMode::ReplaceDefault, 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.add_plugins(OutFlyPlugin);
app.insert_resource(prefs); app.insert_resource(prefs);
app.run(); app.run();