From 10a094c3044600f5f8d95f425c1018328d66a5af Mon Sep 17 00:00:00 2001 From: Aevyrie Roessler Date: Wed, 9 Mar 2022 10:00:07 -0800 Subject: [PATCH] Use reactive rendering for ui examples. --- examples/ui/button.rs | 4 +++- examples/ui/ui.rs | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/ui/button.rs b/examples/ui/button.rs index 0a0191a834fc1..9a1bd6f8891fa 100644 --- a/examples/ui/button.rs +++ b/examples/ui/button.rs @@ -1,10 +1,12 @@ -use bevy::prelude::*; +use bevy::{prelude::*, winit::WinitSettings}; /// This example illustrates how to create a button that changes color and text based on its /// interaction state. fn main() { App::new() .add_plugins(DefaultPlugins) + // Only run the app when there is user input. This will significantly reduce CPU/GPU use. + .insert_resource(WinitSettings::desktop_app()) .add_startup_system(setup) .add_system(button_system) .run(); diff --git a/examples/ui/ui.rs b/examples/ui/ui.rs index 74e1817829ecc..08d6c09272bd9 100644 --- a/examples/ui/ui.rs +++ b/examples/ui/ui.rs @@ -1,12 +1,15 @@ use bevy::{ input::mouse::{MouseScrollUnit, MouseWheel}, prelude::*, + winit::WinitSettings, }; /// This example illustrates the various features of Bevy UI. fn main() { App::new() .add_plugins(DefaultPlugins) + // Only run the app when there is user input. This will significantly reduce CPU/GPU use. + .insert_resource(WinitSettings::desktop_app()) .add_startup_system(setup) .add_system(mouse_scroll) .run();