Skip to content

Commit 691e41a

Browse files
committed
rate limit
1 parent d6e95e9 commit 691e41a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/bevy_winit/src/winit_config.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,17 @@ pub struct WinitSettings {
3838

3939
impl WinitSettings {
4040
/// Default settings for games.
41+
///
42+
/// [`Continuous`](UpdateMode::Continuous) if windows have focus,
43+
/// [`ReactiveLowPower`](UpdateMode::ReactiveLowPower) otherwise.
4144
pub fn game() -> Self {
42-
WinitSettings::default()
45+
WinitSettings {
46+
focused_mode: UpdateMode::Continuous,
47+
unfocused_mode: UpdateMode::ReactiveLowPower {
48+
wait: Duration::from_millis(50), // 20Hz
49+
},
50+
..Default::default()
51+
}
4352
}
4453

4554
/// Default settings for desktop applications.

0 commit comments

Comments
 (0)