basic ui elements

This commit is contained in:
2026-01-15 23:52:09 +01:00
parent b56f667a3a
commit ebf80052f0
13 changed files with 2655 additions and 33 deletions

View File

@@ -181,7 +181,25 @@ int main(const int argc, const char* argv[])
return EXIT_FAILURE;
}
const std::filesystem::path assets_path = std::filesystem::absolute(file.parent_path());
// Find the assets folder by checking for fonts
std::filesystem::path assets_path = std::filesystem::absolute(file.parent_path());
// Walk up the directory tree to find a folder containing .ttf fonts
while (!assets_path.empty() && assets_path.has_parent_path())
{
bool has_fonts = false;
for (const auto& entry : std::filesystem::directory_iterator(assets_path))
{
if (entry.path().extension() == ".ttf")
{
has_fonts = true;
break;
}
}
if (has_fonts) break;
assets_path = assets_path.parent_path();
}
load_fonts(assets_path);
Rml::ElementDocument* document = context->LoadDocument(file.string());