1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Storage and frame refactor (#1418)

The purpose of this is to expose `frame.storage()` and `frame.storage_mut()` so users can save/load app state from the `App::update` function, without having to add another parameter to that function.

Changes:
* Added `Frame::storage()` and `Frame::storage_mut()`
* `App::update` now takes a `&mut Frame` rather than just `&Frame`
* `Frame` is no longer `Clone` or `Sync` (doesn't have to be since https://github.com/emilk/egui/pull/1366)
This commit is contained in:
Emil Ernerfeldt
2022-03-25 21:19:31 +01:00
committed by GitHub
parent bc0fdefceb
commit b7ebe16cfb
27 changed files with 157 additions and 199 deletions

View File

@@ -28,7 +28,7 @@ impl eframe::App for MyApp {
egui::Rgba::TRANSPARENT // Make sure we don't paint anything behind the rounded corners
}
fn update(&mut self, ctx: &egui::Context, frame: &eframe::Frame) {
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
custon_window_frame(ctx, frame, "egui with custom frame", |ui| {
ui.label("This is just the contents of the window");
ui.horizontal(|ui| {
@@ -41,7 +41,7 @@ impl eframe::App for MyApp {
fn custon_window_frame(
ctx: &egui::Context,
frame: &eframe::Frame,
frame: &mut eframe::Frame,
title: &str,
add_contents: impl FnOnce(&mut egui::Ui),
) {