listener handles, auto-clean destroyed listeners, minor refactor

This commit is contained in:
Aleksander
2025-07-06 20:53:40 +02:00
parent 92444bb5c4
commit 857c5ec865
16 changed files with 348 additions and 182 deletions

View File

@@ -1,9 +1,12 @@
use crate::{assets, testbed::Testbed};
use glam::Vec2;
use wgui::{event::EventListenerCollection, layout::Layout};
use wgui::{event::EventListenerCollection, layout::Layout, parser::ParserState};
pub struct TestbedAny {
pub layout: Layout,
#[allow(dead_code)]
state: ParserState,
}
impl TestbedAny {
@@ -12,9 +15,9 @@ impl TestbedAny {
listeners: &mut EventListenerCollection<(), ()>,
) -> anyhow::Result<Self> {
let path = format!("gui/{name}.xml");
let (layout, _state) =
let (layout, state) =
wgui::parser::new_layout_from_assets(Box::new(assets::Asset {}), listeners, &path)?;
Ok(Self { layout })
Ok(Self { layout, state })
}
}