FileOrBuiltIn asset paths, theming support
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::{
|
||||
assets,
|
||||
testbed::{Testbed, TestbedUpdateParams},
|
||||
@@ -21,7 +23,7 @@ pub struct TestbedAny {
|
||||
impl TestbedAny {
|
||||
pub fn new(name: &str) -> anyhow::Result<Self> {
|
||||
let path = if name.ends_with(".xml") {
|
||||
AssetPath::Filesystem(name)
|
||||
AssetPath::FileOrBuiltIn(name)
|
||||
} else {
|
||||
AssetPath::BuiltIn(&format!("gui/{name}.xml"))
|
||||
};
|
||||
@@ -30,6 +32,7 @@ impl TestbedAny {
|
||||
Box::new(assets::Asset {}),
|
||||
wgui::globals::Defaults::default(),
|
||||
&WguiFontConfig::default(),
|
||||
PathBuf::new(), // cwd
|
||||
)?;
|
||||
|
||||
let (layout, state) = wgui::parser::new_layout_from_assets(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::{cell::RefCell, collections::VecDeque, rc::Rc};
|
||||
use std::{cell::RefCell, collections::VecDeque, path::PathBuf, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
assets,
|
||||
@@ -8,9 +8,9 @@ use glam::Vec2;
|
||||
use wgui::{
|
||||
assets::AssetPath,
|
||||
components::{
|
||||
Component,
|
||||
button::{ButtonClickCallback, ComponentButton},
|
||||
checkbox::ComponentCheckbox,
|
||||
Component,
|
||||
},
|
||||
drawing::Color,
|
||||
event::StyleSetRequest,
|
||||
@@ -80,6 +80,7 @@ impl TestbedGeneric {
|
||||
Box::new(assets::Asset {}),
|
||||
wgui::globals::Defaults::default(),
|
||||
&WguiFontConfig::default(),
|
||||
PathBuf::new(), // cwd
|
||||
)?;
|
||||
|
||||
let extra = ParseDocumentExtra {
|
||||
|
||||
Reference in New Issue
Block a user