refactor events; watch prep work

This commit is contained in:
galister
2025-06-27 04:16:24 +09:00
parent 1215a50324
commit afb4919970
21 changed files with 613 additions and 420 deletions

View File

@@ -3,26 +3,26 @@ use glam::Vec2;
use wgui::layout::Layout;
pub struct TestbedAny {
pub layout: Layout,
pub layout: Layout,
}
impl TestbedAny {
pub fn new(name: &str) -> anyhow::Result<Self> {
let path = format!("gui/{name}.xml");
let (layout, _state) = wgui::parser::new_layout_from_assets(Box::new(assets::Asset {}), &path)?;
Ok(Self { layout })
}
pub fn new(name: &str) -> anyhow::Result<Self> {
let path = format!("gui/{name}.xml");
let (layout, _state) =
wgui::parser::new_layout_from_assets(Box::new(assets::Asset {}), &path)?;
Ok(Self { layout })
}
}
impl Testbed for TestbedAny {
fn update(&mut self, width: f32, height: f32, timestep_alpha: f32) -> anyhow::Result<()> {
self
.layout
.update(Vec2::new(width, height), timestep_alpha)?;
Ok(())
}
fn update(&mut self, width: f32, height: f32, timestep_alpha: f32) -> anyhow::Result<()> {
self.layout
.update(Vec2::new(width, height), timestep_alpha)?;
Ok(())
}
fn layout(&mut self) -> &mut Layout {
&mut self.layout
}
fn layout(&mut self) -> &mut Layout {
&mut self.layout
}
}