Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use eframe storage? #27

Open
FreePhoenix888 opened this issue Feb 29, 2024 · 1 comment
Open

How to use eframe storage? #27

FreePhoenix888 opened this issue Feb 29, 2024 · 1 comment

Comments

@FreePhoenix888
Copy link

In eframe we are able to use storage: https://docs.rs/eframe/0.26.2/eframe/index.html#:~:text=app%20state%20using-,cc.storage,-(requires%20the%20%22persistence

How to do it when using egui_overlay?

@coderedart
Copy link
Owner

you just serialize egui memory struct from the context using ctx.memory(|mem| serialize(mem)) and save it to a file. And then load it when starting your app, deserialize it (or create default) and assign it to context using ctx.memory_mut()

https://github.com/emilk/egui/blob/master/crates/eframe/src/native/epi_integration.rs#L348 shows you how eframe does it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants