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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user