Decent asset loading

This commit is contained in:
Dynamitos
2023-07-31 21:43:20 +02:00
parent 1668df467a
commit 4ab924f251
12 changed files with 94 additions and 74 deletions
+10
View File
@@ -72,5 +72,15 @@ void FontLoader::import(FontImportArgs args, PFontAsset asset)
}
FT_Done_Face(face);
FT_Done_FreeType(ft);
auto stream = AssetRegistry::createWriteStream((std::filesystem::path(asset->getFolderPath()) / asset->getName()).replace_extension("asset").string(), std::ios::binary);
ArchiveBuffer archive;
Serialization::save(archive, FontAsset::IDENTIFIER);
Serialization::save(archive, asset->getName());
Serialization::save(archive, asset->getFolderPath());
asset->save(archive);
archive.writeToStream(stream);
asset->setStatus(Asset::Status::Ready);
}