Skip to content

Commit b493165

Browse files
committed
Use reactive rendering for ui examples. (#4164)
# Objective - Use the low power, reactive rendering settings for UI examples. - Make the feature more discoverable by using it in an applicable context.
1 parent 1a85fb5 commit b493165

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

examples/ui/button.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
use bevy::prelude::*;
1+
use bevy::{prelude::*, winit::WinitSettings};
22

33
/// This example illustrates how to create a button that changes color and text based on its
44
/// interaction state.
55
fn main() {
66
App::new()
77
.add_plugins(DefaultPlugins)
8+
// Only run the app when there is user input. This will significantly reduce CPU/GPU use.
9+
.insert_resource(WinitSettings::desktop_app())
810
.add_startup_system(setup)
911
.add_system(button_system)
1012
.run();

examples/ui/ui.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
use bevy::{
22
input::mouse::{MouseScrollUnit, MouseWheel},
33
prelude::*,
4+
winit::WinitSettings,
45
};
56

67
/// This example illustrates the various features of Bevy UI.
78
fn main() {
89
App::new()
910
.add_plugins(DefaultPlugins)
11+
// Only run the app when there is user input. This will significantly reduce CPU/GPU use.
12+
.insert_resource(WinitSettings::desktop_app())
1013
.add_startup_system(setup)
1114
.add_system(mouse_scroll)
1215
.run();

0 commit comments

Comments
 (0)