basic ui elements
This commit is contained in:
20
main.cpp
20
main.cpp
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user