@@ -37,8 +37,17 @@ pub struct WinitSettings {
37
37
38
38
impl WinitSettings {
39
39
/// Default settings for games.
40
+ ///
41
+ /// [`Continuous`](UpdateMode::Continuous) if windows have focus,
42
+ /// [`RateLimited`](UpdateMode::RateLimited) otherwise.
40
43
pub fn game ( ) -> Self {
41
- WinitSettings :: default ( )
44
+ WinitSettings {
45
+ focused_mode : UpdateMode :: Continuous ,
46
+ unfocused_mode : UpdateMode :: RateLimited {
47
+ wait : Duration :: from_millis ( 50 ) , // 20Hz
48
+ } ,
49
+ ..Default :: default ( )
50
+ }
42
51
}
43
52
44
53
/// Default settings for desktop applications.
@@ -93,6 +102,17 @@ pub enum UpdateMode {
93
102
/// until an [`AppExit`](bevy_app::AppExit) event appears:
94
103
/// - enough time has elapsed since the previous update
95
104
/// - a redraw is requested
105
+ RateLimited {
106
+ /// The minimum time to wait from the start of one update to the next.
107
+ ///
108
+ /// **Note:** This has no upper limit.
109
+ /// Bevy will wait forever if you set this to [`Duration::MAX`].
110
+ wait : Duration ,
111
+ } ,
112
+ /// The [`App`](bevy_app::App) will update in response to the following,
113
+ /// until an [`AppExit`](bevy_app::AppExit) event appears:
114
+ /// - enough time has elapsed since the previous update
115
+ /// - a redraw is requested
96
116
/// - new window or device events have appeared
97
117
Reactive {
98
118
/// The minimum time from the start of one update to the next.
0 commit comments