mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 14:49:06 -04:00
* Part of https://github.com/emilk/egui/issues/5113 * Part of https://github.com/emilk/egui/issues/3524 ## What This deprecates `eframe::App::update` and replaces it with two new functions: ```rs pub trait App { /// Called just before `ui`, and in the future this will /// also be called for background apps when needed. fn logic(&mut self, ctx: &egui::Context, frame: &mut Frame) { } /// Show your user interface to the user. fn ui(&mut self, ui: &mut egui::Ui, frame: &mut Frame); … } ``` Similarly, `Context::run` is deprecated in favor of `Context::run_ui`. `Plugin`s are now handed a `Ui` instead of just a `Context` in `on_begin/end_frame`. ## TODO …either in this PR or a later one * [x] Deprecate `App::update` * [x] Deprecate `Context::run` * [x] Change plugins to get a `Ui` * [x] Update kittest * [x] Change viewports to get UI:s (`show_viewport_immediate` etc) - https://github.com/emilk/egui/pull/7779 ## Later PRs * [ ] Deprecate `Panel::show` * [ ] Deprecate `CentralPanel::show` * [ ] Deprecate `CentralPanel` ?
Example running an eframe application on an external eventloop on top of a tokio executor on Linux.
By running the event loop, eframe, and tokio in the same thread, one can leverage local async tasks. These tasks can share data with the UI without the need for locks or message passing.
In tokio CPU-bound async tasks can be run with spawn_blocking to avoid impacting the UI frame rate.
cargo run -p external_eventloop_async --features linux-example