Update RmlManager.cpp

This commit is contained in:
GabsPuNs
2026-06-11 18:20:45 -04:00
parent 50bac00e31
commit 617273e1e6

View File

@@ -37,12 +37,7 @@ bool RmlManager::Init(int viewport_width, int viewport_height)
}
// Set asset path for RmlUi files (relative to exe directory)
char exePath[MAX_PATH];
GetModuleFileNameA(nullptr, exePath, MAX_PATH);
char* lastSlash = strrchr(exePath, '\\');
if (lastSlash)
*(lastSlash + 1) = '\0';
Rml::String assetPath = Rml::String(exePath) + "Assets/UI";
Rml::String assetPath = utils.GetExeDir().string() + "/Assets/UI";
m_file_interface->SetAssetPath(assetPath);
Rml::SetRenderInterface(m_renderer.get());
@@ -55,11 +50,14 @@ bool RmlManager::Init(int viewport_width, int viewport_height)
return false;
}
// GabsPuN: Hardcoded. Is this really needed?
/*
// Load default fonts
Rml::LoadFontFace("C:/Windows/Fonts/segoeui.ttf", false);
Rml::LoadFontFace("C:/Windows/Fonts/segoeuib.ttf", false);
Rml::LoadFontFace("C:/Windows/Fonts/segoeuii.ttf", false);
Rml::LoadFontFace("C:/Windows/Fonts/segoeuiz.ttf", false);
*/
// Minecraft's UI fonts (from tryashtar/minecraft-ttf)
if (!Rml::LoadFontFace(assetPath + "/fonts/Mojangles.ttf", "Minecraft Default", Rml::Style::FontStyle::Normal, Rml::Style::FontWeight::Normal, false))
@@ -132,6 +130,8 @@ void RmlManager::Render()
m_renderer->BeginFrame();
//GabsPuN: This DebugPrintf is called each frame when RMLUI is not used.
/*
int docCount = 0;
for (int i = 0; i < m_context->GetNumDocuments(); i++)
{
@@ -141,6 +141,7 @@ void RmlManager::Render()
}
if (docCount == 0)
app.DebugPrintf("[RmlManager] WARNING: No visible documents in context\n");
*/
m_context->Render();
m_renderer->EndFrame();