@@ -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.
@@ -94,6 +103,17 @@ pub enum UpdateMode {
94
103
/// until an [`AppExit`](bevy_app::AppExit) event appears:
95
104
/// - enough time has elapsed since the previous update
96
105
/// - a redraw is requested
106
+ RateLimited {
107
+ /// The minimum time to wait from the start of one update to the next.
108
+ ///
109
+ /// **Note:** This has no upper limit.
110
+ /// Bevy will wait forever if you set this to [`Duration::MAX`].
111
+ wait : Duration ,
112
+ } ,
113
+ /// The [`App`](bevy_app::App) will update in response to the following,
114
+ /// until an [`AppExit`](bevy_app::AppExit) event appears:
115
+ /// - enough time has elapsed since the previous update
116
+ /// - a redraw is requested
97
117
/// - new window or device events have appeared
98
118
Reactive {
99
119
/// The minimum time from the start of one update to the next.
0 commit comments