fix uidev
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
use wgui::{event::EventListenerCollection, layout::RcLayout};
|
||||
use wgui::layout::RcLayout;
|
||||
|
||||
pub mod testbed_any;
|
||||
pub mod testbed_dashboard;
|
||||
pub mod testbed_generic;
|
||||
|
||||
pub struct TestbedUpdateParams<'a> {
|
||||
pub listeners: &'a mut EventListenerCollection<(), ()>,
|
||||
pub struct TestbedUpdateParams {
|
||||
pub width: f32,
|
||||
pub height: f32,
|
||||
pub timestep_alpha: f32,
|
||||
|
||||
@@ -5,7 +5,6 @@ use crate::{
|
||||
use glam::Vec2;
|
||||
use wgui::{
|
||||
assets::AssetPath,
|
||||
event::EventListenerCollection,
|
||||
globals::WguiGlobals,
|
||||
layout::{LayoutParams, RcLayout},
|
||||
parser::{ParseDocumentParams, ParserState},
|
||||
@@ -19,7 +18,7 @@ pub struct TestbedAny {
|
||||
}
|
||||
|
||||
impl TestbedAny {
|
||||
pub fn new(name: &str, listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
||||
pub fn new(name: &str) -> anyhow::Result<Self> {
|
||||
let path = AssetPath::BuiltIn(&format!("gui/{name}.xml"));
|
||||
|
||||
let globals = WguiGlobals::new(
|
||||
@@ -28,7 +27,6 @@ impl TestbedAny {
|
||||
)?;
|
||||
|
||||
let (layout, state) = wgui::parser::new_layout_from_assets(
|
||||
listeners,
|
||||
&ParseDocumentParams {
|
||||
globals,
|
||||
path,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::testbed::{Testbed, TestbedUpdateParams};
|
||||
use wgui::{event::EventListenerCollection, layout::RcLayout};
|
||||
use wgui::layout::RcLayout;
|
||||
|
||||
pub struct TestbedDashboard {
|
||||
layout: RcLayout,
|
||||
@@ -7,9 +7,8 @@ pub struct TestbedDashboard {
|
||||
}
|
||||
|
||||
impl TestbedDashboard {
|
||||
pub fn new(listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
||||
let (frontend, layout) =
|
||||
dash_frontend::Frontend::new(dash_frontend::FrontendParams { listeners })?;
|
||||
pub fn new() -> anyhow::Result<Self> {
|
||||
let (frontend, layout) = dash_frontend::Frontend::new()?;
|
||||
Ok(Self { frontend, layout })
|
||||
}
|
||||
}
|
||||
@@ -19,7 +18,6 @@ impl Testbed for TestbedDashboard {
|
||||
let mut frontend = self.frontend.borrow_mut();
|
||||
frontend.update(
|
||||
&self.frontend,
|
||||
params.listeners,
|
||||
params.width,
|
||||
params.height,
|
||||
params.timestep_alpha,
|
||||
|
||||
@@ -8,12 +8,11 @@ use glam::Vec2;
|
||||
use wgui::{
|
||||
assets::AssetPath,
|
||||
components::{
|
||||
Component,
|
||||
button::{ButtonClickCallback, ComponentButton},
|
||||
checkbox::ComponentCheckbox,
|
||||
Component,
|
||||
},
|
||||
drawing::Color,
|
||||
event::EventListenerCollection,
|
||||
globals::WguiGlobals,
|
||||
i18n::Translation,
|
||||
layout::{Layout, LayoutParams, RcLayout, Widget},
|
||||
@@ -71,7 +70,7 @@ fn handle_button_click(button: Rc<ComponentButton>, label: Widget, text: &'stati
|
||||
}
|
||||
|
||||
impl TestbedGeneric {
|
||||
pub fn new(listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
||||
pub fn new() -> anyhow::Result<Self> {
|
||||
const XML_PATH: AssetPath = AssetPath::BuiltIn("gui/various_widgets.xml");
|
||||
|
||||
let globals = WguiGlobals::new(
|
||||
@@ -107,7 +106,6 @@ impl TestbedGeneric {
|
||||
};
|
||||
|
||||
let (layout, state) = wgui::parser::new_layout_from_assets(
|
||||
listeners,
|
||||
&ParseDocumentParams {
|
||||
globals: globals.clone(),
|
||||
path: XML_PATH,
|
||||
@@ -190,7 +188,7 @@ impl TestbedGeneric {
|
||||
|
||||
fn show_popup(
|
||||
&mut self,
|
||||
params: &mut TestbedUpdateParams,
|
||||
_params: &mut TestbedUpdateParams,
|
||||
layout: &mut Layout,
|
||||
data: &mut Data,
|
||||
) -> anyhow::Result<()> {
|
||||
@@ -198,7 +196,6 @@ impl TestbedGeneric {
|
||||
globals: self.globals.clone(),
|
||||
position: Vec2::new(128.0, 128.0),
|
||||
layout,
|
||||
listeners: params.listeners,
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user