refactor code and support utf8 strings rendering

This commit is contained in:
ohyzha
2024-08-02 23:08:24 +03:00
parent 875ad80337
commit 9589b4d39f
11 changed files with 70 additions and 30 deletions

View File

@@ -15,13 +15,13 @@ namespace OpenVulkano
std::vector<std::unique_ptr<ResourceLoader>> m_loaders;
public:
Array<char> GetResource(const std::string& resourceName, std::string& resourcePath) override
Array<char> GetResource(const std::string& resourceName) override
{
for(auto& loader : m_loaders)
{
try
{
auto res = loader->GetResource(resourceName, resourcePath);
auto res = loader->GetResource(resourceName);
if (!res.Empty()) return res;
}
catch (const std::exception& e)
@@ -54,6 +54,30 @@ namespace OpenVulkano
}
return false;
}
std::string GetResourcePath(const std::string& resourceName) override
{
try
{
for (auto& loader: m_loaders)
{
auto res = loader->GetResourcePath(resourceName);
if (!res.empty())
{
return res;
}
}
}
catch (const std::exception& e)
{
Logger::FILESYS->error("Error trying to get resource path for '{}'! Error: {}", resourceName, e.what());
}
catch (...)
{
Logger::FILESYS->error("Unknown error trying to get resource path for '{}'!", resourceName);
}
return "";
}
};
ResourceLoader& ResourceLoader::GetInstance()