@@ -37,8 +37,17 @@ pub struct WinitSettings {
3737
3838impl WinitSettings {
3939 /// Default settings for games.
40+ ///
41+ /// [`Continuous`](UpdateMode::Continuous) if windows have focus,
42+ /// [`RateLimited`](UpdateMode::RateLimited) otherwise.
4043 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+ }
4251 }
4352
4453 /// Default settings for desktop applications.
@@ -94,6 +103,17 @@ pub enum UpdateMode {
94103 /// until an [`AppExit`](bevy_app::AppExit) event appears:
95104 /// - enough time has elapsed since the previous update
96105 /// - 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
97117 /// - new window or device events have appeared
98118 Reactive {
99119 /// The minimum time from the start of one update to the next.
0 commit comments