FileOrBuiltIn asset paths, theming support
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use crate::{
|
||||
assets::AssetPath,
|
||||
components::{Component, button, tooltip},
|
||||
components::{button, tooltip, Component},
|
||||
drawing::Color,
|
||||
i18n::Translation,
|
||||
layout::WidgetID,
|
||||
parser::{
|
||||
AttribPair, ParserContext, ParserFile, parse_check_f32, parse_check_i32, parse_children, print_invalid_attrib,
|
||||
process_component,
|
||||
parse_check_f32, parse_check_i32, parse_children, print_invalid_attrib, process_component,
|
||||
style::{parse_color_opt, parse_round, parse_style, parse_text_style},
|
||||
AttribPair, ParserContext, ParserFile,
|
||||
},
|
||||
widget::util::WLength,
|
||||
};
|
||||
@@ -62,10 +62,10 @@ pub fn parse_component_button<'a>(
|
||||
"hover_border_color" => {
|
||||
parse_color_opt(value, &mut hover_border_color);
|
||||
}
|
||||
"sprite_src" | "sprite_src_ext" | "sprite_src_internal" => {
|
||||
"sprite_src" | "sprite_src_builtin" | "sprite_src_internal" => {
|
||||
let asset_path = match key {
|
||||
"sprite_src" => AssetPath::BuiltIn(value),
|
||||
"sprite_src_ext" => AssetPath::Filesystem(value),
|
||||
"sprite_src" => AssetPath::FileOrBuiltIn(value),
|
||||
"sprite_src_builtin" => AssetPath::BuiltIn(value),
|
||||
"sprite_src_internal" => AssetPath::WguiInternal(value),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@@ -551,7 +551,7 @@ fn parse_tag_include(
|
||||
for pair in attribs {
|
||||
#[allow(clippy::single_match)]
|
||||
match pair.attrib.as_ref() {
|
||||
"src" | "src_ext" | "src_internal" => {
|
||||
"src" | "src_builtin" | "src_internal" => {
|
||||
path = Some({
|
||||
let this = &file.path.clone();
|
||||
let include: &str = &pair.value;
|
||||
@@ -564,9 +564,9 @@ fn parse_tag_include(
|
||||
"src" => match this {
|
||||
AssetPathOwned::WguiInternal(_) => AssetPathOwned::WguiInternal(new_path),
|
||||
AssetPathOwned::BuiltIn(_) => AssetPathOwned::BuiltIn(new_path),
|
||||
AssetPathOwned::Filesystem(_) => AssetPathOwned::Filesystem(new_path),
|
||||
AssetPathOwned::FileOrBuiltIn(_) => AssetPathOwned::FileOrBuiltIn(new_path),
|
||||
},
|
||||
"src_ext" => AssetPathOwned::Filesystem(new_path),
|
||||
"src_builtin" => AssetPathOwned::BuiltIn(new_path),
|
||||
"src_internal" => AssetPathOwned::WguiInternal(new_path),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
@@ -583,7 +583,7 @@ fn parse_tag_include(
|
||||
}
|
||||
|
||||
let Some(path) = path else {
|
||||
log::warn!("include tag with no source! specify either: src, src_ext, src_internal");
|
||||
log::warn!("include tag with no source! specify either: src, src_builtin, src_internal");
|
||||
return Ok(());
|
||||
};
|
||||
let path_ref = path.as_ref();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
assets::AssetPath,
|
||||
layout::WidgetID,
|
||||
parser::{AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, style::parse_style},
|
||||
parser::{parse_children, parse_widget_universal, style::parse_style, AttribPair, ParserContext, ParserFile},
|
||||
renderer_vk::text::custom_glyph::{CustomGlyphContent, CustomGlyphData},
|
||||
widget::sprite::{WidgetSprite, WidgetSpriteParams},
|
||||
};
|
||||
@@ -22,10 +22,10 @@ pub fn parse_widget_sprite<'a>(
|
||||
for pair in attribs {
|
||||
let (key, value) = (pair.attrib.as_ref(), pair.value.as_ref());
|
||||
match key {
|
||||
"src" | "src_ext" | "src_internal" => {
|
||||
"src" | "src_builtin" | "src_internal" => {
|
||||
let asset_path = match key {
|
||||
"src" => AssetPath::BuiltIn(value),
|
||||
"src_ext" => AssetPath::Filesystem(value),
|
||||
"src" => AssetPath::FileOrBuiltIn(value),
|
||||
"src_builtin" => AssetPath::BuiltIn(value),
|
||||
"src_internal" => AssetPath::WguiInternal(value),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user