cached image loading

This commit is contained in:
galister
2025-12-27 22:06:28 +09:00
parent f4545241df
commit 8747487beb
8 changed files with 126 additions and 41 deletions

View File

@@ -7,7 +7,7 @@ use wgui::{
event::{CallbackDataCommon, EventAlterables},
i18n::Translation,
parser::{Fetchable, parse_color_hex},
renderer_vk::text::custom_glyph::{CustomGlyphContent, CustomGlyphData},
renderer_vk::text::custom_glyph::CustomGlyphData,
taffy,
widget::{
image::WidgetImage, label::WidgetLabel, rectangle::WidgetRectangle, sprite::WidgetSprite,
@@ -117,12 +117,11 @@ fn apply_custom_command(
.parser_state
.fetch_widget(&panel.layout.state, element)
{
let content = CustomGlyphContent::from_assets(
let data = CustomGlyphData::from_assets(
&app.wgui_globals,
wgui::assets::AssetPath::File(path),
)
.context("Could not load content from supplied path.")?;
let data = CustomGlyphData::new(content);
if let Some(mut sprite) = pair.widget.get_as::<WidgetSprite>() {
sprite.set_content(&mut com, Some(data));