Trying ttf loading

This commit is contained in:
Dynamitos
2022-04-13 13:01:46 +02:00
parent bebfb94752
commit 3fec36295a
42 changed files with 563 additions and 549 deletions
+34
View File
@@ -0,0 +1,34 @@
#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()
{
}
void FontLoader::importAsset(const std::filesystem::path& filePath)
{
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);
AssetRegistry::get().registerFont(asset);
import(filePath, asset);
}
void FontLoader::import(std::filesystem::path path, PFontAsset asset)
{
asset->load();
AssetRegistry::get().registerFont(asset);
}