From ab852c5426b90211b57b0c096a7ada522845b200 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Mon, 4 Dec 2023 21:07:20 +0000 Subject: [PATCH] performance: only run bevy App when there is user input Former-commit-id: d408a3a16c164cb2375ea42fe5710b5b63f4a924 --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d97a60b..2adde83 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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::() .init_resource::() + // 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();