Easiest way to force a refresh every x milliseconds #342
-
Current the window only updates when it needs to, which is great but what about being able to override this? What's the simplest way to do this? Say I want to force the screen to refresh every x milliseconds |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
There is no simple way to do this in eframe at the moment. What you can do is clone the |
Beta Was this translation helpful? Give feedback.
-
It wasn't clear to me if you specifically wanted a refresh/repaint that was not every frame--but if "a refresh/repaint every frame " is okay then you can use egui/egui_demo_lib/src/apps/demo/multi_touch.rs Lines 136 to 137 in 0b52813 and egui/egui_demo_lib/src/wrap_app.rs Lines 158 to 247 in b155996 But if a refresh every frame is too frequent then you'd want to use the approach @emilk suggested. Some docs here: https://docs.rs/egui/0.11.0/egui/struct.Context.html#method.request_repaint |
Beta Was this translation helpful? Give feedback.
It wasn't clear to me if you specifically wanted a refresh/repaint that was not every frame--but if "a refresh/repaint every frame " is okay then you can use
request_repaint()
in yourupdate()
method, as used in some of the demos, e.g.:egui/egui_demo_lib/src/apps/demo/multi_touch.rs
Lines 136 to 137 in 0b52813
and
egui/egui_demo_lib/src/wrap_app.rs
Lines 158 to 247 in b155996