@@ -14,8 +14,7 @@ use bevy::{
14
14
/// * While continuously sending `RequestRedraw` events in `Wait` mode: the app will use resources
15
15
/// regardless of window state.
16
16
///
17
- /// * While in `Poll` mode: the app will update continuously, but will suspend app updates when
18
- /// minimized. Notice resource usage never drops to zero even when minimized.
17
+ /// * While in `Poll` mode: the app will update continuously
19
18
fn main ( ) {
20
19
App :: new ( )
21
20
. insert_resource ( WinitConfig {
@@ -55,19 +54,19 @@ fn cycle_modes(
55
54
TestMode :: Wait => TestMode :: WaitAndRedraw ,
56
55
TestMode :: WaitAndRedraw => TestMode :: Poll ,
57
56
TestMode :: Poll => TestMode :: Wait ,
57
+ } ;
58
+ winit_config. control_flow = match * mode {
59
+ TestMode :: Wait => ControlFlow :: Wait ,
60
+ TestMode :: WaitAndRedraw => ControlFlow :: Wait ,
61
+ TestMode :: Poll => ControlFlow :: Poll ,
58
62
}
59
63
}
60
- winit_config. control_flow = match * mode {
61
- TestMode :: Wait => ControlFlow :: Wait ,
62
- TestMode :: WaitAndRedraw => {
63
- // Sending a `RequestRedraw` event is useful when you want the app to update again
64
- // regardless of any user input. For example, your application might use `ControlFlow::Wait`
65
- // to reduce power use, but UI animations need to play even when there are no inputs, so you
66
- // send redraw requests while the animation is playing.
67
- event. send ( RequestRedraw ) ;
68
- ControlFlow :: Wait
69
- }
70
- TestMode :: Poll => ControlFlow :: Poll ,
64
+ if let TestMode :: WaitAndRedraw = * mode {
65
+ // Sending a `RequestRedraw` event is useful when you want the app to update again
66
+ // regardless of any user input. For example, your application might use `ControlFlow::Wait`
67
+ // to reduce power use, but UI animations need to play even when there are no inputs, so you
68
+ // send redraw requests while the animation is playing.
69
+ event. send ( RequestRedraw ) ;
71
70
}
72
71
}
73
72
@@ -82,7 +81,7 @@ pub(crate) mod test_setup {
82
81
/// Rotate the cube to make it clear when the app is updating
83
82
pub ( crate ) fn rotate ( mut cube_transform : Query < & mut Transform , With < Rotator > > ) {
84
83
for mut transform in cube_transform. iter_mut ( ) {
85
- transform. rotate ( Quat :: from_rotation_x ( 0.05 ) ) ;
84
+ transform. rotate ( Quat :: from_rotation_x ( 0.04 ) ) ;
86
85
transform. rotate ( Quat :: from_rotation_y ( 0.08 ) ) ;
87
86
}
88
87
}
0 commit comments