Skip to content

Commit

Permalink
rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
maniwani committed Jul 25, 2023
1 parent 31f40d5 commit 7acf9a0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions crates/bevy_winit/src/winit_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ pub struct WinitSettings {
pub unfocused_mode: UpdateMode,
}
impl WinitSettings {
/// Configure winit with common settings for a game.
/// Default settings for games.
///
/// [`Continuous`](UpdateMode::Continuous) if windows have focus,
/// [`ReactiveLowPower`](UpdateMode::ReactiveLowPower) otherwise.
pub fn game() -> Self {
WinitSettings::default()
WinitSettings {
focused_mode: UpdateMode::Continuous,
unfocused_mode: UpdateMode::ReactiveLowPower {
max_wait: Duration::from_millis(50), // 20Hz
},
..Default::default()
}
}

/// Configure winit with common settings for a desktop application.
/// Default settings for desktop applications.
///
/// [`Reactive`](UpdateMode::Reactive) if windows have focus,
/// [`ReactiveLowPower`](UpdateMode::ReactiveLowPower) otherwise.
pub fn desktop_app() -> Self {
WinitSettings {
focused_mode: UpdateMode::Reactive {
Expand Down

0 comments on commit 7acf9a0

Please sign in to comment.