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:
@@ -31,9 +31,11 @@ pub struct State {
|
||||
|
||||
impl State {
|
||||
fn new(canvas_id: &str, pixels_per_point: f32) -> Result<State, JsValue> {
|
||||
let emigui = Emigui::new(pixels_per_point);
|
||||
emigui_wasm::load_memory(emigui.ctx());
|
||||
Ok(State {
|
||||
example_app: Default::default(),
|
||||
emigui: Emigui::new(pixels_per_point),
|
||||
emigui,
|
||||
webgl_painter: emigui_wasm::webgl::Painter::new(canvas_id)?,
|
||||
frame_times: Default::default(),
|
||||
})
|
||||
@@ -111,6 +113,8 @@ impl State {
|
||||
pixels_per_point,
|
||||
)?;
|
||||
|
||||
emigui_wasm::save_memory(self.emigui.ctx()); // TODO: don't save every frame
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user