2022-04-13 13:01:35 +02:00
|
|
|
#include "FontLoader.h"
|
|
|
|
|
#include "Graphics/Graphics.h"
|
|
|
|
|
#include "FontAsset.h"
|
|
|
|
|
#include "AssetRegistry.h"
|
|
|
|
|
|
|
|
|
|
using namespace Seele;
|
|
|
|
|
|
|
|
|
|
FontLoader::FontLoader(Gfx::PGraphics graphics)
|
|
|
|
|
: graphics(graphics)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FontLoader::~FontLoader()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-21 18:43:21 +01:00
|
|
|
void FontLoader::importAsset(const std::filesystem::path& filePath, const std::string& importPath)
|
2022-04-13 13:01:35 +02:00
|
|
|
{
|
|
|
|
|
std::filesystem::path assetPath = filePath.filename();
|
|
|
|
|
assetPath.replace_extension("asset");
|
|
|
|
|
PFontAsset asset = new FontAsset(assetPath.generic_string());
|
|
|
|
|
std::error_code code;
|
|
|
|
|
std::filesystem::copy_file(filePath, asset->getFullPath(), code);
|
|
|
|
|
asset->setStatus(Asset::Status::Loading);
|
2023-01-21 18:43:21 +01:00
|
|
|
AssetRegistry::get().registerFont(asset, importPath);
|
2022-04-13 13:01:35 +02:00
|
|
|
import(filePath, asset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FontLoader::import(std::filesystem::path path, PFontAsset asset)
|
|
|
|
|
{
|
|
|
|
|
asset->load();
|
|
|
|
|
}
|