1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Store/restore emigui memory state (window positions, sizes etc)

This commit is contained in:
Emil Ernerfeldt
2020-05-02 11:37:12 +02:00
parent d52cccde7b
commit bfbb669d02
19 changed files with 154 additions and 60 deletions

View File

@@ -46,6 +46,9 @@ fn main() {
let mut example_app = ExampleWindow::default();
let mut clipboard = emigui_glium::init_clipboard();
let memory_path = "emigui.json";
emigui_glium::read_memory(&emigui.ctx(), memory_path);
while running {
{
// Keep smooth frame rate. TODO: proper vsync
@@ -113,6 +116,10 @@ fn main() {
painter.paint_batches(&display, paint_batches, emigui.texture());
emigui_glium::handle_output(output, &display, clipboard.as_mut());
}
if let Err(err) = emigui_glium::write_memory(&emigui.ctx(), memory_path) {
eprintln!("ERROR: Failed to save emigui state: {}", err);
}
}
pub fn mean_frame_time(frame_times: &VecDeque<f64>) -> f64 {