@@ -16,7 +16,7 @@ fn main() {
16
16
. insert_resource ( WinitSettings :: game ( ) )
17
17
// Power-saving reactive rendering for applications.
18
18
. insert_resource ( WinitSettings :: desktop_app ( ) )
19
- // You can also customize update behavior with the fields of [`WinitConfig `]
19
+ // You can also customize update behavior with the fields of [`WinitSettings `]
20
20
. insert_resource ( WinitSettings {
21
21
focused_mode : bevy:: winit:: UpdateMode :: Continuous ,
22
22
unfocused_mode : bevy:: winit:: UpdateMode :: ReactiveLowPower {
@@ -61,13 +61,16 @@ fn update_winit(
61
61
use ExampleMode :: * ;
62
62
* winit_config = match * mode {
63
63
Game => {
64
- // In the default `WinitConfig ::game()` mode:
64
+ // In the default `WinitSettings ::game()` mode:
65
65
// * When focused: the event loop runs as fast as possible
66
- // * When not focused: the event loop runs as fast as possible
66
+ // * When not focused: the app will update when the window is directly interacted with
67
+ // (e.g. the mouse hovers over a visible part of the out of focus window), a
68
+ // [`RequestRedraw`] event is received, or one sixtieth of a second has passed
69
+ // without the app updating (60 Hz refresh rate max).
67
70
WinitSettings :: game ( )
68
71
}
69
72
Application => {
70
- // While in `WinitConfig ::desktop_app()` mode:
73
+ // While in `WinitSettings ::desktop_app()` mode:
71
74
// * When focused: the app will update any time a winit event (e.g. the window is
72
75
// moved/resized, the mouse moves, a button is pressed, etc.), a [`RequestRedraw`]
73
76
// event is received, or after 5 seconds if the app has not updated.
@@ -80,7 +83,7 @@ fn update_winit(
80
83
ApplicationWithRedraw => {
81
84
// Sending a `RequestRedraw` event is useful when you want the app to update the next
82
85
// frame regardless of any user input. For example, your application might use
83
- // `WinitConfig ::desktop_app()` to reduce power use, but UI animations need to play even
86
+ // `WinitSettings ::desktop_app()` to reduce power use, but UI animations need to play even
84
87
// when there are no inputs, so you send redraw requests while the animation is playing.
85
88
event. send ( RequestRedraw ) ;
86
89
WinitSettings :: desktop_app ( )
@@ -101,9 +104,9 @@ pub(crate) mod test_setup {
101
104
/// Switch between update modes when the mouse is clicked.
102
105
pub ( crate ) fn cycle_modes (
103
106
mut mode : ResMut < ExampleMode > ,
104
- mouse_button_input : Res < ButtonInput < KeyCode > > ,
107
+ button_input : Res < ButtonInput < KeyCode > > ,
105
108
) {
106
- if mouse_button_input . just_pressed ( KeyCode :: Space ) {
109
+ if button_input . just_pressed ( KeyCode :: Space ) {
107
110
* mode = match * mode {
108
111
ExampleMode :: Game => ExampleMode :: Application ,
109
112
ExampleMode :: Application => ExampleMode :: ApplicationWithRedraw ,
@@ -173,7 +176,7 @@ pub(crate) mod test_setup {
173
176
commands. spawn ( (
174
177
TextBundle :: from_sections ( [
175
178
TextSection :: new (
176
- "Press spacebar to cycle modes\n " ,
179
+ "Press space bar to cycle modes\n " ,
177
180
TextStyle {
178
181
font_size : 50.0 ,
179
182
..default ( )
0 commit comments