performance: only run bevy App when there is user input

Former-commit-id: d408a3a16c164cb2375ea42fe5710b5b63f4a924
This commit is contained in:
Muhammad Nauman Raza 2023-12-04 21:07:20 +00:00
parent 458689d9ce
commit 5b73311b4c
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -1,4 +1,4 @@
use bevy::{core_pipeline::tonemapping::Tonemapping, prelude::*, window::*};
use bevy::{core_pipeline::tonemapping::Tonemapping, prelude::*, window::*, winit::WinitSettings};
use bevy_egui::{egui, EguiContexts, EguiPlugin};
@ -48,6 +48,8 @@ fn main() {
))
.init_resource::<UiState>()
.init_resource::<OpenWindows>()
// Only run the app when there is user input, reducing resource usage
.insert_resource(WinitSettings::desktop_app())
.add_systems(Startup, (setup, setup_ui))
.add_systems(Update, (render_ui, movement))
.run();