add 'separate' atlas type & get rid of assets loading entries duplicates

This commit is contained in:
MihailRis
2024-11-20 04:30:19 +03:00
parent 0144709e03
commit 784f93666c
3 changed files with 42 additions and 2 deletions
+14
View File
@@ -43,7 +43,11 @@ void AssetsLoader::add(
const std::string& alias,
std::shared_ptr<AssetCfg> settings
) {
if (enqueued.find({tag, alias}) != enqueued.end()){
return;
}
entries.push(aloader_entry {tag, filename, alias, std::move(settings)});
enqueued.insert({tag, alias});
}
bool AssetsLoader::hasNext() const {
@@ -148,6 +152,16 @@ void AssetsLoader::processPreload(
std::make_shared<SoundCfg>(map.at("keep-pcm").get(keepPCM)));
break;
}
case AssetType::ATLAS: {
std::string typeName = "atlas";
map.at("type").get(typeName);
auto type = AtlasType::ATLAS;
if (typeName == "separate") {
type = AtlasType::SEPARATE;
}
add(tag, path, name, std::make_shared<AtlasCfg>(type));
break;
}
default:
add(tag, path, name);
break;