This commit is contained in:
Isuru Samarathunga
2025-10-14 01:50:56 +05:30
parent 13e8c538c7
commit 58f2190199
13 changed files with 261 additions and 45 deletions

View File

@ -452,10 +452,11 @@ namespace ia::iae
Rml::LoadFontFace(path.c_str());
}
VOID UI::SetHTML(IN CONST String &source)
VOID UI::SetMarkup(IN CONST String &markup, IN CONST String &styles)
{
g_document->SetStyleSheetContainer(Rml::Factory::InstanceStyleSheetString(styles.c_str()));
g_document->SetInnerRML(
BuildString("<body style=\"display: block; width: 100%; height: 100%;\">", source, "</body>").c_str());
BuildString("<body style=\"display: block; width: 100%; height: 100%;\">", markup, "</body>").c_str());
}
VOID UI::AddClickEvent(IN PCCHAR elementId, IN std::function<VOID()> callback)
@ -502,8 +503,14 @@ namespace ia::iae
Rml::TextureHandle RmlUIRenderInterface::LoadTexture(Rml::Vector2i &texture_dimensions, const Rml::String &source)
{
return Engine::CreateImageFromFile(Engine::GetUniqueResourceName(), source.c_str(), texture_dimensions.x,
texture_dimensions.y);
Handle result;
if (source.starts_with("$H$"))
result = (Handle) std::stoi(source.substr(3));
else
result = Engine::CreateImageFromFile(Engine::GetUniqueResourceName(), source.c_str());
const auto extent = Engine::GetImageExtent(result);
texture_dimensions = {extent.x, extent.y};
return result;
}
Rml::TextureHandle RmlUIRenderInterface::GenerateTexture(Rml::Span<const Rml::byte> source,