uidev: re-format code
This commit is contained in:
@@ -1,48 +1,46 @@
|
||||
use crate::{assets, testbed::Testbed};
|
||||
use glam::Vec2;
|
||||
use wgui::{
|
||||
event::EventListenerCollection,
|
||||
globals::WguiGlobals,
|
||||
layout::Layout,
|
||||
parser::{ParseDocumentParams, ParserState},
|
||||
event::EventListenerCollection,
|
||||
globals::WguiGlobals,
|
||||
layout::Layout,
|
||||
parser::{ParseDocumentParams, ParserState},
|
||||
};
|
||||
|
||||
pub struct TestbedAny {
|
||||
pub layout: Layout,
|
||||
pub layout: Layout,
|
||||
|
||||
#[allow(dead_code)]
|
||||
state: ParserState,
|
||||
#[allow(dead_code)]
|
||||
state: ParserState,
|
||||
}
|
||||
|
||||
impl TestbedAny {
|
||||
pub fn new(
|
||||
name: &str,
|
||||
listeners: &mut EventListenerCollection<(), ()>,
|
||||
) -> anyhow::Result<Self> {
|
||||
let path = format!("gui/{name}.xml");
|
||||
pub fn new(name: &str, listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
||||
let path = format!("gui/{name}.xml");
|
||||
|
||||
let globals = WguiGlobals::new(Box::new(assets::Asset {}))?;
|
||||
let globals = WguiGlobals::new(Box::new(assets::Asset {}))?;
|
||||
|
||||
let (layout, state) = wgui::parser::new_layout_from_assets(
|
||||
listeners,
|
||||
&ParseDocumentParams {
|
||||
globals,
|
||||
path: &path,
|
||||
extra: Default::default(),
|
||||
},
|
||||
)?;
|
||||
Ok(Self { layout, state })
|
||||
}
|
||||
let (layout, state) = wgui::parser::new_layout_from_assets(
|
||||
listeners,
|
||||
&ParseDocumentParams {
|
||||
globals,
|
||||
path: &path,
|
||||
extra: Default::default(),
|
||||
},
|
||||
)?;
|
||||
Ok(Self { layout, state })
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user