UpdateMode::Continuous
or UpdateMode::reactive(Duration::from_secs_f64(1. / refresh_rate))
#19835
-
Assume there's a 60 fps monitor, I want to update 60 times / s. So: pub fn setup(
mut cmds: Commands,
winit: NonSend<WinitWindows>,
window: Query<Entity, With<PrimaryWindow>>,
) {
let window = window.single().expect("primary window should exist");
let monitor = winit
.get_window(window)
.and_then(|w| w.current_monitor())
.expect("primary window should have winit window and monitor");
let refresh_rate = monitor
.refresh_rate_millihertz()
.expect("monitor should have refresh rate");
cmds.insert_resource(WinitSettings {
focused_mode: UpdateMode::reactive(Duration::from_secs_f64(1000. / refresh_rate as f64)),
unfocused_mode: UpdateMode::reactive_low_power(Duration::from_secs(60)),
});
} But
Whether |
Beta Was this translation helpful? Give feedback.
Answered by
kingwingfly
Jun 27, 2025
Replies: 1 comment
-
I found that the refresh won't happen before mouse click releasing. So, I'd better choose |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kingwingfly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found that the refresh won't happen before mouse click releasing. So, I'd better choose
UpdateMode::Continuous
.