Skip to content

Replace App::update with fn logic and fn ui#7775

Merged
emilk merged 19 commits intomainfrom
emilk/app-ui
Dec 16, 2025
Merged

Replace App::update with fn logic and fn ui#7775
emilk merged 19 commits intomainfrom
emilk/app-ui

Conversation

@emilk
Copy link
Copy Markdown
Owner

@emilk emilk commented Dec 14, 2025

What

This deprecates eframe::App::update and replaces it with two new functions:

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.

Plugins are now handed a Ui instead of just a Context in on_begin/end_frame.

TODO

…either in this PR or a later one

Later PRs

  • Deprecate Panel::show
  • Deprecate CentralPanel::show
  • Deprecate CentralPanel ?

@emilk emilk added the eframe Relates to epi and eframe label Dec 14, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 14, 2025

Preview available at https://egui-pr-preview.github.io/pr/7775-emilkapp-ui
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk changed the title eframe: Add Frame::logic and Frame::ui eframe: Replace Frame::update with fn logic and fn ui Dec 14, 2025
@emilk emilk force-pushed the emilk/app-ui branch 2 times, most recently from 3b1ce87 to c72c3c6 Compare December 14, 2025 17:35
@emilk emilk marked this pull request as ready for review December 15, 2025 15:48
@emilk emilk requested a review from lucasmerlin as a code owner December 15, 2025 15:48
@emilk emilk merged commit 2f6fe9c into main Dec 16, 2025
47 checks passed
@emilk emilk deleted the emilk/app-ui branch December 16, 2025 16:05
@emilk emilk added the egui label Dec 16, 2025
@emilk emilk changed the title eframe: Replace Frame::update with fn logic and fn ui Replace App::update with fn logic and fn ui Mar 26, 2026
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
* Part of emilk#5113
* Part of emilk#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)
  - emilk#7779

## Later PRs
* [ ] Deprecate `Panel::show`
* [ ] Deprecate `CentralPanel::show`
* [ ] Deprecate `CentralPanel` ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eframe Relates to epi and eframe egui_kittest egui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant