Trying ttf loading
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "AssetRegistry.h"
|
||||
#include "MeshAsset.h"
|
||||
#include "FontAsset.h"
|
||||
#include "TextureAsset.h"
|
||||
#include "FontLoader.h"
|
||||
#include "TextureLoader.h"
|
||||
#include "MaterialLoader.h"
|
||||
#include "MeshLoader.h"
|
||||
@@ -37,6 +39,10 @@ void AssetRegistry::importFile(const std::string &filePath)
|
||||
{
|
||||
get().importTexture(fsPath);
|
||||
}
|
||||
if(extension.compare(".ttf") == 0)
|
||||
{
|
||||
get().importFont(fsPath);
|
||||
}
|
||||
if (extension.compare(".asset") == 0)
|
||||
{
|
||||
get().importMaterial(fsPath);
|
||||
@@ -55,6 +61,11 @@ PTextureAsset AssetRegistry::findTexture(const std::string &filePath)
|
||||
return get().textures[filePath];
|
||||
}
|
||||
|
||||
PFontAsset AssetRegistry::findFont(const std::string& name)
|
||||
{
|
||||
return get().fonts[name];
|
||||
}
|
||||
|
||||
PMaterialAsset AssetRegistry::findMaterial(const std::string &filePath)
|
||||
{
|
||||
return get().materials[filePath];
|
||||
@@ -84,6 +95,7 @@ void AssetRegistry::init(const std::filesystem::path &rootFolder, Gfx::PGraphics
|
||||
{
|
||||
AssetRegistry ® = get();
|
||||
reg.rootFolder = rootFolder;
|
||||
reg.fontLoader = new FontLoader(graphics);
|
||||
reg.meshLoader = new MeshLoader(graphics);
|
||||
reg.textureLoader = new TextureLoader(graphics);
|
||||
reg.materialLoader = new MaterialLoader(graphics);
|
||||
@@ -104,6 +116,11 @@ void AssetRegistry::importTexture(const std::filesystem::path &filePath)
|
||||
textureLoader->importAsset(filePath);
|
||||
}
|
||||
|
||||
void AssetRegistry::importFont(const std::filesystem::path& filePath)
|
||||
{
|
||||
fontLoader->importAsset(filePath);
|
||||
}
|
||||
|
||||
void AssetRegistry::importMaterial(const std::filesystem::path &filePath)
|
||||
{
|
||||
materialLoader->importAsset(filePath);
|
||||
@@ -131,6 +148,11 @@ void AssetRegistry::registerTexture(PTextureAsset texture)
|
||||
textures[texture->getFileName()] = texture;
|
||||
}
|
||||
|
||||
void AssetRegistry::registerFont(PFontAsset font)
|
||||
{
|
||||
fonts[font->getFileName()] = font;
|
||||
}
|
||||
|
||||
void AssetRegistry::registerMaterial(PMaterialAsset material)
|
||||
{
|
||||
materials[material->getFileName()] = material;
|
||||
|
||||
Reference in New Issue
Block a user